WordPress Gains a JSON REST API Plugin

Patricio Robles
Jun. 13 2014, 04:22PM EDT

WordPress has maintained its popularity despite lacking a built-in REST API that enables external applications to easily interact with a WordPress-based website's content and users. That will likely soon change, however. A WordPress plug-in dubbed WP API extends the open source content management system with a full REST API that uses JSON and OAuth authentication. WP API recently hit version 1.0, and its creator, Ryan McCue, is pushing to have it integrated into the WordPress core as early as the next major release, 4.0.

Using the WP API plug-in, developers can read, add and edit all of their WordPress content, including post metadata, custom post types and comments, and the 1.0 release adds the ability to create, view, edit and delete user accounts. In effect, the WP API now makes it possible to fully manage a WordPress site and access all of its content via a REST API.

"Accessing data remotely is a common goal for many WordPress users and developers," McCue wrote. "The ability to access and update data remotely is used by desktop publishing software, mobile applications, and in-browser applications. These users need to be able to access WordPress data in a standardised, interoperable manner."

WordPress has an XML-RPC API, but that looks less and less ideal in a world dominated by REST and JSON. McCue points to complexities around generating and parsing XML, as well as the structure of the RPC calls the current API offers. Given the years-long decline in XML's popularity, a more thoughtfully designed REST API based on JSON seemingly offers a better path to the type of interoperability developers are seeking from WordPress.

WordPress as Platform

As the popularity of WordPress has grown, so too have the ways it's being used. No longer a simple content management system ideally suited to blogs, WordPress is more and more frequently used as an application framework to build highly interactive websites. A REST API fits well into that paradigm and supports a variety of use cases.

For instance, while the WordPress administrative interface is often praised for its ease of use and polish, a REST API would enable developers to more easily build web and mobile administrative clients of their own. A REST API could also make it easier for developers to more easily implement more complex front-end functionality into their WordPress themes. With this in mind, the WP API includes a JavaScript reference client.

More fundamentally, a developer-friendly REST API would allow developers to leverage WordPress purely as a back end, creating their own custom administrative and end user-facing interfaces. This may be the most exciting potential use of a new WordPress API, raising the possibility that WordPress could in the near future become a true content management platform and not just a content management system.

Patricio Robles Follow me on Google+

Comments

Comments(1)

SusanO

XML-RPC API that is currently provided in core WordPress, however JSON REST API provides more flexibility and power to developers for allowing remote access to data.

XML-RPC API was designed for integration into WordPress, it follows WP coding standards and will enter the core with full translatability. The JSON REST API is being built to eventually include every data type found in WordPress, including post types and their metadata. It’s also built with extensibility in mind for themes and plugins and makes liberal use of actions and filters.

At Elegant MicroWeb we find that there are a few advantages/benefits which includes:

·         JSON Stadard used for Data serialization, which can be used in most programming languages

·         HTTP 1.1 standard uses for ommunication with the API, which is available in almost every programming language. REST are used for interaction, which are compatible in the majority of HTTP clients

·         Internal structure and coding is regular PHP code, Which enables using the data layer of the API for other uses

·         The API relies on no external services. It includes methods for automatically locating the API given only a WordPress site address

  <a href=”http://www.elegantmicroweb.com/it-services/enterprise-cms-portal-applica...” title=WordPress Developers”>WordPress Developers</a>