Join Morten Rand-Hendriksen for an in-depth discussion in this video What is the WP-API?, part of WordPress REST API (WP-API): First Look (2015).
- What is the word press rest API or WP API for short? Well that's a good question. If you've been following the ins and outs of word press core development for the last couple of years you may have heard talk of the WP API or the WordPress JSON rest API or JSON API or something similar but it's just as likely this is the first time you're hearing of any of this. So whatever the case, let me make the introductions. The WP API is a RESTful API that can be accessed through simply HTTP requests to access the data on a WORDpress site in JSON format.
That's quite a mouthful so here's the English translation, the WP API is a new way of accessing the data WordPress provides without having to go through a theme, or a RSS feed, or XML-RPC. And when I say accessing I don't just mean getting the data to read. With the WP API you'll be able to create, read, update, and delete content in the WordPress database without interacting with WordPress directly. And this opens up a whole new world of possibilities.
Let me explain. Up until now if you wanted to read a WordPress pulsar page you had to use a WordPress query in PHP typically through a WordPress theme. The theme would use the WordPress templating engine and hierarchy, otherwise known as a theme, to output the post or page or other content you requested through the address bar on your browser. This set up had some severe limitations. If for example, you wanted the content from your WordPress site to appear in a mobile app you would have to either build a custom PHP application to do it or pass the data through antiquated protocols.
And that's just the tip of the iceberg. The WP API also allows us to access and edit the data in the database without going through WordPress Admin. Now before you get worried, this is only possible if you had the right security credentials so your data is not at risk. But it means we can now build new interfaces for creating content with WordPress. Just think about that for a minute. WordPress without the WordPress Admin panel. In this course we'll take a very shallow dip into the ocean of possibilities the WP API opens up.
We'll look at the API and how to interact with it and I'll show you how to use it, add some basic AJAX functionality to your site. In future courses, we'll dive deeper and look at how to manage content with the API as well. But that's for later.
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