The WordPress REST API: no longer a CMS, but a development framework

4 min reading
Developers / 17 August 2016
The WordPress REST API: no longer  a CMS, but a development framework
The WordPress REST API: no longer  a CMS, but a development framework

BBVA API Market

One of the most recent great revolutions in information technology is the universalization of content management systems (CMS). Drupal, Joomla, Fork CMS and TextPattern have all made it easy for users to create blogs and websites, but the main contributor to these results has been the king of the accessible CMS: WordPress. A simple system designed for the majority of users, with default templates so you can begin publishing from the word go, hundreds of plugins to upgrade the features of the CMS, and now with a REST API to enhance the development possibilities.

WordPress has become the leader in universal access to publishing information: 60% of the websites developed from a CMS are based on WordPress. A comparison of WordPress searches with other content management systems such as Drupal or Joomla, reveals notable differences. Users who wish to create a blog for publication find WordPress particularly attractive, largely because word-of-mouth has worked so effectively with this high-quality CMS.

As WordPress has gradually become more famous, it has also received greater recognition. A few years ago, almost any professional publishing project was obliged to develop its own CMS. Today this is becoming just another thing of the past. WordPress offers a wider, more flexible and scalable service on which many companies rely for their publishing projects: WordPress VIP. Any project in WordPress is likely to want to create new publishing projects in the future, like a web app or a mobile app. That would require, for example, automating the content updating processes. This is the reason for launching a REST API.

Features of the WordPress REST API

The REST API allows data to be collected in the JSON format on any website developed in WordPress in a simple way through HTTP requests: information related to nine different types of object, including messages, pages, comments, taxonomies (tags to order the content in terms of subjects, geographical units or people’s names) or user profiles. Updating, modifying or recovering these data is simple.

The HTTP protocol (Hyper Text Transfer Protocol) enables the information to be shared between a customer (a desktop computer, a smartphone or a tablet), normally by JavaScript code, and a web server. These HTTP requests are the ones normally used by REST APIs to interact.

Thanks to the launch of this application programming interface, WordPress is now no longer simply a system of content management –WordPress has become a framework. The only thing any development team or user who wishes to start using this REST API needs to know is that it’s available with a plugin, although the idea in the short term is for it to form part of the actual WordPress core.

The HTTP requests for creating, recovering, modifying or deleting data, both text entries and users or tags, are really accessible: the usual POST (create), GET (recover), PUT (change) and DELETE (eliminate).

– HTTP request to create a new post for a blog or webpage in WordPress: POST /wp-json/wp/v2/posts.

– HTTP request to retrieve entry with ID 100: GET /wp-json/wp/v2/posts/123.

– HTTP request to update the user with ID 4: /wp-json/wp/v2/users/4.

– HTTP request to search for entries that use the word “Brexit”: GET /wp-json/wp/v2/posts?search=brexit.

– HTTP request to delete the post with ID 100: DELETE /wp-json/wp/v2/posts/123

The WordPress API, a new world

With the launch of the WordPress API, the question is… where does this new service take us? There are practical cases today where companies –whether or not they are media companies– are already using the application programming interface very successfully. This is the only way to understand the impact of this API:

– The WordPress API gives freedom and complete flexibility to any developer or professional with a project in this CMS. In fact, thanks to the API it’s no longer necessary to use the WordPress template engine. You can continue using the back-end of the CMS and have your own front-end in a separate server. The front-end will paint the information it extracts from the server API wherever the WordPress back-end is. The New York Times uses the REST API for its direct coverage; other media such as Mashable and Techcrunch use WordPress VIP, with a back-end from WordPress but with a front-end (templates) that’s totally their own. 

– The API not only allows the front-end and back-end to be dissociated in different servers, it also actually enables the typical WordPress back-end to be written. This means that on the basis of the WordPress CMS, a team of developers can customize the content management system for any digital project, such as a web app, mobile app and so on.

– Another benefit is that a WordPress project can be integrated with the user’s own or third-party apps. In this case WordPress would become a space for storing data which would feed new projects such as webpages or apps thanks to the interaction of the API –for example, an app developed in Node.js– and for these products to be able to request, update or delete information in WordPress with the API. This is the start of a vast movement, where WordPress becomes the base layer for launching apps. This has a name –a development framework. A highly versatile framework for the management of users and contents.

Are you interested in financial APIs? See BBVA’s catalog at this website

It may interest you