Wondering what REST is? Here’s an entry-level glance at what you could expect from WordPress REST API.
One of the hottest topics for discussion today is the merge of REST API into WordPress core. Rightly so, this has been the most substantial change since 2003, the year when the 0.7 version of WordPress was released.
In this article, we describe what APIs and REST architecture are, how they can benefit your WordPress website, and why it’s awesome. This way, before we discuss the WordPress REST API, it’s important to identify some terminology and background information.
An API: What Is It
Do you use Facebook/ Twitter app/ Google Analytics or buy anything online? Do you wear a Fitbit or Nike FuelBand? Any yes’s to these questions? (congrats) You’re already benefiting from APIs!
The first thing to you should know about an API is that it stands for Application Programming Interface. Sounds pretty geeky, right? It does until you think of APIs as of shipping containers transporting content between ports of call.
An API makes it possible for developers to interact with application data in a programmatic way. Here is an example. Facebook’s API gives developers the ability to get all of the friends associated with any user. Since the API includes a documentation (a specific set of instructions), it is easy for a developer to get the needed data.
REST Architecture
REST (Representational State Transfer) is an architecture style for designing networked applications. An API can be considered RESTful if its architecture fits a certain way of constraints. To find out what these constraints are, click here. The idea behind REST is to provide an easier alternative for such complex technologies as CORBA, RPC or SOAP. To enable this, REST uses HTTP.
HTTP Requests
REST API is much more effective thanks to HTTP (Hyper Text Transfer Protocol). The reason for this is that this protocol enables sharing information between a client (laptop, cell phone, tablet, etc.) and a server. As an example, let’s see how a status is being published to a Facebook timeline. On behalf of a Facebook user, an HTTP request is sent from a JavaScript code (client) to Facebook’s API (server). Once the user’s status is published, the client (JavaScript code) would receive a response from Facebook’s server stating that the operation has been successfully fulfilled.
In simple words, HTTP request scenario functions as follows:
- A client sends an HTTP request to a server;
- The server sends an HTTP response back.
REST functions on the base of HTTP methods. Here’s why it might be great for you.
Use Cases for the WP API
One more improvement that comes with WordPress API is that you can now perform any of the four CRUD (Create, Read, Update, Delete) actions against any of your WordPress site’s resources (posts, pages, media, post meta, post revisions, comments, taxonomies, terms, users). Thanks to this, you can use the WP API to create a post, retrieve, update, or delete posts associated with your WordPress website.
Now that you have hopefully got a better understanding of what APIs, REST architecture, HTTP requests, and WP API are, we are going to explore a couple of possible use cases, as well as WordPress REST API implementations by a referral to the direct speech of WordPress co-founder, Matt Mullenweg.
Appealing to his words, the WP REST API is going to be “huge and revolutionary for developers”, which means there will be even more powerful plugins, new ecstatic themes, and applications that have not even appeared to be powered by WordPress before.
Matt continues: “It really gets amazing when it’s combined with something else. Imagine a future version of HappyTables… where they don’t modify WP admin at all. It just creates a custom interface that talks purely over the REST API. Instead of trying to hack everything in WP admin.”
“I think [the] REST API is the beginning of WP admin becoming just one of many clients for managing WordPress. Think of WP admin as PHP, plus HTML, plus JavaScript clients. I think that you will see native clients. I think you’ll see pure JavaScript clients. I think you’ll see other PHP, HTML, JS clients; perhaps in the [vein] of HappyTables or some other verticals that have sprung up around WordPress”. He thinks that it may “make the admin [dashboard] something that you can replace as easily as you can replace the themes.”
To access your site’s data through an easy-to-use HTTP REST API, explore it’s latest version here.
Final Words
As you can tell, we’re really excited about using the WP API as well as the implications of the WP REST API and the amazing functionality that will result from its use.
We hope this has provided a good overview of what APIs are and how they relate to WordPress. Today, almost every business is digital. To successfully navigate in this hi-tech world, there’s a need to meet both: a technology and a mindset shift.
If you’re looking forward to level up your website, consider testing out your site on WordPress CMS. Try the automated forum and website migration service aisite and your migration to WordPress will be the smoothest process ever. You may start with Free trial and see how your web project will look on WordPress paying nothing.