JSON REST API Slated For WordPress 4.1 Release

WordPress core contributors came to a consensus today during the development meeting regarding the immediate future of the JSON REST API project. Ryan McCue and his team released version 1.0 over the weekend and have been pushing hard for it to be ready for the upcoming 4.0 release.

When I spoke with McCue yesterday about the API’s readiness for 4.0, he said, “At this point, the API is considered feature complete. The upcoming 1.1 release is going to be heavily focused on testing and documentation, plus some general bug fixing as per usual. Moving forward, we’ll basically just be building out new features as needed.”

The discussion today resulted in an agreement to put the WP API project on the 4.1 roadmap, as it still hasn’t received the requisite testing and real-world exposure that core contributors would like to see before giving it the green light.

“I think it’s ‘ready’ for use, which is exciting,” Nacin said, when weighing in on the API during the meeting. “Now we just have to get it ready for the next five years and 22% of the internet.”

Nacin suggested putting it squarely on the 4.1 roadmap with hopes of attracting more core contributors for the final mile. Although everyone is excited about having this new API in core, it’s an addition that all agreed is worthy of stronger core feedback before pushing it forward.

The WP API in the Wild

Meanwhile, more real-world examples of the API in use are popping up. Eric Andrew Lewis, a web developer for the New York Times, remarked, “We’re implementing it as of yesterday because it’s stable now.” K. Adam White also commented on the most recent make.wordpress.org update to report that his team is already making use of the API at Bocoup.

We’re using the API as the content backend for an in-development Node.js website and several single-page applications; nothing I can share publicly yet, but the API project was the tipping point that let me convince my colleagues that WordPress was a suitable backend for a non-PHP application. We’re really excited about the work we’re doing and I look forward to sharing it later in the year.

Although McCue feels that the API is ready for WordPress 4.0, those present at the development meeting agreed that more eyes and testers will help to ensure that the API enters core in a more robust state.

How WordPress Plugin and Theme Developers Can Help Test the WP API

photo credit: shenamt – cc

WordPress developers are already doing some exciting things, such as creating plugins based on the API, i.e. the BuddyPress JSON API and the Pods JSON API that emerged shortly after 1.0 was released. McCue believes that finding your own special interest is a good way to join in testing the API:

Contributing to a large project like WordPress core or the API isn’t always the easiest thing to do; these projects have certain rules and standards that can be annoying to have to deal with. The API is very much structured as the base for developers to build off, and it’s always much easier building with something you know, so I think finding something you’re familiar with and trying to integrate that with the API is a great way to both learn it, and help us test it out.

McCue is also keen to get WordPress theme developers testing the API with their projects, using the project’s Javascript library. “We’ve tried to design this so that even frontend developers with minimal knowledge of WordPress can go out and start creating, and those with WP knowledge can feel at home,” he said.

During the development meeting McCue was asked about the advantages of theming with the API vs. calling the database through conventional (PHP) means. “You can do nice stuff like loading new content without a full page load,” he said. “And because of WP API’s internal reusability, you can also render it server side with practically the same code.” Others chimed in that lazy loading, AJAX calls, infinite scroll and the like will be much easier to implement with the new API.

“The biggest effect I think the REST API will have is in opening up this data to other developers, including plugin and theme developers,” McCue said. “We’re increasingly seeing more advanced front ends, including Theme Foundry’s Collections theme, P2 and the upcoming o2, and sites like Quartz, and WP API will enable these sorts of sites to be built much quicker.”

In the past, these sorts of projects were extraordinarily unique endeavors that required a great deal of effort to build. With the JSON REST API finally added to WordPress core, the platform will be more open to unique use cases.

“The API will enable front end developers to build themes on WordPress without needing to know PHP or many of WP’s quirks,” McCue said. “I believe it will really open up WordPress as a framework that’s easily accessible to everyone.” As the project stands today, the team is working towards making improvements that will ensure the API’s readiness for WordPress 4.1. If you have feedback to add from working with version 1.0 or would like to contribute to the project, join the WP API Team Tuesdays in the #wordpress-dev channel on IRC at 00:00 UTC.