The KickPress API makes use of the URL “permalink” structure to pass parameters to the KickPress plugin. Any parameter pairs passed after “/api/” are assumed to belong to the KickPress API permalink structure, any parameters passed in the URL before the URL fragment “/api/” are assumed to belong to the WordPress permalink structure. KickPress looks for the “/api/” string fragment in the URL to determine if there is an API request being executed. Whatever parameters pairs are found in the URL after the “/api/” string fragment are rewritten into query string parameters by KickPress before they reach WorkPress.
So, the API URL requests passed through the URL permalinks are translated by the KickPress plugin, here are some examples:
API Actions are operations that take place on the web server and perform changes to WordPress content, such as updating and deleting posts, or applying tags and categories. Each action query takes one of two forms: simple or parameterized. Simple action queries are single action names to be executed on the selected post or collection, as determined by the WP portion of the permalink. Parameterized action queries are also action names with an extra parameter that modifies how the action is to be executed (which taxonomy to apply terms from, for instance). Formatted action queries will look something like the following:
Built-in API Actions
The following actions are built into the API base class and are valid by default for all post types:
Either inserts or updates the post specified by the post slug in the WP permalink. Post content is sent in the HTTP request
Deletes the post specified by the post slug in the WP permalink.
Adds terms to the post specified by the post slug in the WP permalink. Taxonomy must be specified as action parameter. Terms are passed as slugs following action call.
Removes terms from the post specified by the post slug in the WP permalink. Taxonomy must be specified as action parameter. Terms are passed as slugs following action call.
Toggles terms on the post specified by the post slug in the WP permalink. Taxonomy must be specified as the action parameter. Terms are passed as slugs following action call.
Adds a bookmark on the post specified by the post slug in the WP permalink for the currently logged-in user.
Removes the bookmark on the post specified by the post slug in the WP permalink for the currently logged-in user.
Toggles the bookmark on the post specified by the post slug in the WP permalink for the currently logged-in user.
Adds a note to the post specified by the post slug in the WP permalink for the currently logged-in user. Note content is passed in the HTTP request.
Adds a note for the currently logged-in user. The note ID must be passed as the action parameter. Note content is passed in the HTTP request.
Deletes a note for the currently logged-in user. The note ID must be passed as the action parameter.
API views are custom templates that render the post(s) requested in the WP permalink for alternative use cases, such as an input form or data table. Formatted view queries will look something like the following:
Single Post: /post_type/post_name/api/view_name
The form view is a special case. All other custom views are loaded from their corresponding theme templates. In the case of form, the view is generated programmatically according to the post type’s custom fields. If a post slug is specified, the form will be populated with the corresponding post’s content.
API filters add specific criteria to a query. Each filter takes one of two forms: simple or parameterized. Simple filters are basic key-value pairs where the key is the name of the filter and the value is a string to be matched against the post. Parameterized filters are also key-value pairs with an extra parameter that specifies how the filter is to be applied (which taxonomy to match terms against, for instance). Formatted filters will look something like the following:
Filters can be combined in a single url to produce very specific result sets. A parameterized filter can even be used multiple times, provided each instance of the filter uses a different parameter value.
This filter is a typical keyword search. Keywords are matched in the posts’ title, content, and custom fields. Posts with matches for ANY keyword across ANY field are selected. (This is different from WP search where only posts with matches for ALL keywords across ANY fields are selected.) Keywords can be specified by url-encoded whitespace or a comma-separated list.
This filter will select all posts of the given post type written by the specified author(s). Multiple authors can be specified by a comma-separated list.
This filter will select all posts published after the MIN date, before the MAX date, or between the MIN and MAX dates, according to which dates are specified. All comparisons are inclusive, so posts published on a given date are selected. Values passed to this filter must be formatted date strings (YYYY-MM-DD).
This filter will select all posts with the specified field (either standard or custom) exactly matching one of the specified values. Multiple values can be specified by a comma-separated list.
This filter will select all posts belonging to the given set of taxonomy terms. Multiple terms for a given taxonomy can be specified as a comma-separated list.
This filter will select all posts whose admin-specified alphabar field begins with the specified character. This filter can only receive a single value. Special cases are made for the keyword “0-9” which matches all digits and the keyword “all” which matches all characters. The alphabar field is chosen from the admin panel for the specified post type.
API Sorting and Pagination
This parameter will sort the selected posts by the specified field and ordering. Nested sorting can be done using multiple sorts.
This parameter will change the number of posts displayed on each page of an archive view. This will change the number of pages in the archive accordingly.