Join Morten Rand-Hendriksen for an in-depth discussion in this video Checking the API index, part of WordPress REST API (WP-API): First Look.
- View Offline
- [Voiceover] Now you know how to interact…with the WP API using Postman, I'm pretty sure…the first question you have is, 'How do I know…which routes I can use and what endpoints are available?'…The cool thing is, WP API provides you with an index…of all available routes and their endpoints.…To get to that index, all you have to do…is type in the URL to the site and wp-json/wp/v2.…This is a first level route.…All the other routes start with this,…and then continue onwards.…
When you run this base route,…you end up with the index of the APIs.…If I scroll down here, you'll see exactly what I mean.…The first available route or namespace is wp/v2,…which is the one we're under.…This route has one method, or endpoint,…called GET and all it does is return the index.…If we scroll down here, you can see that the GET method,…the endpoint, has two arguments.…We can pass a namespace, and we can pass a context.…None of these are necessary because they have defaults…but you can mess with them if you want to.…
The index is not very interesting for us,…
With the WP API, developers can access the data on a WordPress site—such as users, posts, and categories—programmatically. The result is an expansion of the already limitless field of possibilities where theme and plugin development is concerned.
This course is a first look at the WP API: what it is, how to get it running, how to interact with it, what it can do for us, and what we can do with it. Join Morten Rand-Hendriksen, your guide and WordPress guru, as he walks through the tools and major features (such as routes and endpoints) of the WP API, as well as a short project that shows how this new API will be used in real-world workflows.
- Installing the WP API
- Exploring common routes
- Examining WP API output
- Building plugins with the WP API
- Crafting WP API URL requests
- Creating AJAX functions with the WP API