WP-API Routes and Endpoints
A list route or endpoint is a url on your website that returns data such as posts and pages to the app. Here are a list of example endpoints:
- http://mysite.com/wp-json/wp/v2/posts
- http://mysite.com/wp-json/wp/v2/pages
- http://mysite.com/wp-json/wp/v2/media
- http://mysite.com/wp-json/wp/v2/comments
- http://mysite.com/wp-json/wp/v2/categories
Some endpoints (such as users) require authentication. AppPresser does not have a way to handle authenticated endpoints at this time.
Custom Post Types
Custom post types and post meta data may not show up in the API by default. You can add these to the API with some simple code. View this article for help.
Note that some custom endpoints cannot be used in the app out of the box without customization.
To add custom content to the list item display, you can use template hooks.
Customize Your Routes
The WP-API allows you to add parameters to your query to show custom results. For example, to show a certain category, you would add this url as your route:
https://yoursite.com/wp-json/wp/v2/posts?categories=40
The '40' at the end is the category term ID. You can do the same for tags by changing the parameter to ?tags=XX. How to find the category or tag ID.
There are other parameters available, such as author, orderby, exclude, and more. For a full list, please see the "Arguments" section here. You can string parameters like this:
https://yoursite.com/wp-json/wp/v2/posts?categories=40&author=1&exclude=214
You would put that full url as the list route in your custom page.
For more information, please view this blog post, and the WP-API documentation.