WordPress JSON REST API Version 1.0 Released

Version 1.0 of the JSON REST API plugin was released over the weekend, adding new user, revision and post meta endpoints. This release also introduces the project’s new long-term backwards compatibility policy for its internal PHP API and REST API, which will not be broken from this point forward as new endpoints and data are added.

The WP API project is led by Ryan McCue, who said that the team is pushing hard for integration into WordPress 4.0, although it is not yet guaranteed. McCue published an integration plan for getting the WP API into core for the 4.0 merge window, if the project receives the green light.

Understanding the Benefits of the JSON REST API

McCue’s proposal highlights the need for an alternative to the XML-RPC API that is currently provided in core and demonstrates how the JSON REST API provides a superior solution for allowing remote access to data.

Because the WP API was designed from the ground up for integration into WordPress, it follows WP coding standards and will enter the core with full translatability. The WP 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.

In addition to the huge benefit of the API being built FOR WordPress, McCue sites several other distinct benefits to its inclusion in core, including:

  • Data serialization uses the JSON standard, which maps more directly to common data structures in most programming languages.
  • Communication with the API uses the HTTP 1.1 standard, available in almost every programming language. Representational State Transfer (“REST”) semantics are used for interaction, which are available in the majority of HTTP clients, and compatibility is provided for those without this ability.
  • The data serialization layer is independent of the data manipulation and accessing layer, enabling the JSON or HTTP semantics to be replaced with another protocol, (i.e. MessagePack or Cap’n Proto.)
  • The internal structure of the API allows use by regular PHP code. This enables using the data layer of the API for other uses, such as a future version of WP-CLI or internal form handlers.
  • The API relies on no external services. It includes methods for automatically locating the API given only a WordPress site address, as well as programatically assessing the availability of parts of the API.

WordPress Developers are Already Building API Plugins

This API constitutes a monolithic addition to the WordPress codebase but it opens up a whole new world for developers who are extending the platform to access information remotely. Shortly after version 1.0 was released, a few WordPress developers reported back about making use of the API in their projects.

bp-json-apiRyan Fugate (@modemlooper), took the initiative to add BuddyPress JSON API endpoints. When Scott Kingsley Clark saw the starter scaffolding for the BuddyPress API, he was inspired to build a Pods JSON API for his Pods Framework in just a few short hours.

McCue and his team of contributors are now starting on a documentation and testing push to prepare the plugin for possible inclusion into WordPress 4.0. A documentation site is now up at wp-api.github.io. These docs are very much in transition as the project moves forward and will eventually include the guides and master docs which are in different places right now. If you’d like to jump in on some open issues or help with the WP API project, the team welcomes new contributors on its O2 development blog.

Who is Sarah Gooding


Sarah Gooding is an Editorial Ninja at Audrey Capital. When not writing about WordPress, she enjoys baking, knitting, judging beer competitions and spending time with her Italian Greyhound.

There are 5 comments

Comments are closed.