That was until a small, dedicated group decided to change all that. Growing out of Google’s 2012 Summer of Code, the group now boasts scores of dedicated contributors and by WordPress 4.5 in 2016, the Rest API was potentially available to any WordPress site.
Wait... What is Rest API?
REST is acronym for REpresentational State Transfer. It is architectural style for distributed hypermedia systems ans was first presented by Roy Fielding in 2000 in his famous dissertation.
Guiding Principles of REST
Client–server: By separating the user interface concerns from the data storage concerns, we improve the portability of the user interface across multiple platforms and improve scalability by simplifying the server components.
Stateless: Each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client.
Cacheable: Cache constraints require that the data within a response to a request be implicitly or explicitly labeled as cacheable or non-cacheable. If a response is cacheable, then a client cache is given the right to reuse that response data for later, equivalent requests.
Uniform interface: By applying the software engineering principle of generality to the component interface, the overall system architecture is simplified and the visibility of interactions is improved. In order to obtain a uniform interface, multiple architectural constraints are needed to guide the behavior of components. REST is defined by four interface constraints: identification of resources; manipulation of resources through representations; self-descriptive messages; and, hypermedia as the engine of application state.
Layered system: The layered system style allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot “see” beyond the immediate layer with which they are interacting.
Code on demand (optional): REST allows client functionality to be extended by downloading and executing code in the form of applets or scripts. This simplifies clients by reducing the number of features required to be pre-implemented.
Where can I find the API on your WordPress site?
If you are running WordPress 4.5 or later, you can see the raw output by going to: http://yourwordpressdomain.com/wp-json
This might not be too friendly to human eyes, but it is not meant to be. If you’d like to navigate it visually though, you can install either the JSONView browser extension for Chrome or Firefox, or for power users, Postman for Chrome.
What can I do with Rest API for WordPress?
The basic element of the Rest API in WordPress is something called a “route”. Routes are URLs that you can use to call objects and collections (groups of objects). If you are familiar with the core objects of WordPress, you’ll recognize many of these such as users, terms, comments and posts.
For example, if you wanted to call upon and manipulate the post data for your site, you could use this URL:
Experiment with the read aspect of the Rest API and get comfortable with basic concepts like filtering and formatting. Once you’re comfortable, you can explore the GET and POST functionality to manipulate this data quickly and conveniently for authoring your own plugins!
I'm the front-man of It's WordPress. I come from a diverse array of backgrounds, enjoying the opportunity to expand my knowledge base and skill set by re-inventing myself. I enjoy environments that focus on emerging information, technology and concepts. I put on the technical hat in my early 20s and never really looked back. I'm love technology and the internet, as well as the outdoors and avidly hike, kayak and camp every chance I get.
We can take you from concept, through design, development and deployment in one seamless process. Whether you choose a self-managed web site or need a continuing support relationship; we've got you covered.