Using The New WordPress REST API: Tally Code Camp 2014

Josh Pollock - October 25, 2014

Today I will be presenting at Tallahassee Code Camp 2014 on WordPress’ new RESTful API. My slides are embedded below:

Be sure to read my articles in Torque for more information on using the WordPress Rest API.

Frequently Asked Questions

Is This A Plugin, A Feature of WordPress or What?

Over the last two years, most big features of WordPress have been developed as plugins before being merged into WordPress itself. Right now the API is a plugin, that will *hopefully* be merged into WordPress core in version 4.1 or 4.2.

It is totally functional and committed to not breaking backwards compatibility. The “plugin as a feature” development model has a lot of advantages over working with patches to core only, One of those advantages is that you can easily use the feature while it’s under development. The other is that even if it doesn’t make it into core, it can still be used as a plugin.

Isn’t It Part of JetPack?

JetPack has its own RESTful API. Here’s a good slide breaking down the pros and cons of the JetPack API. JetPack’s RESTful API runs on WordPress.com’s servers, which may or may not be a good thing, depending on your needs and worldview on decentralization. The fact that it doesn’t work for local development is a big issue for me.

Is This Going To Replace XML-RPC In WordPress?

Yes and no. I doubt XML-RPC is going anywhere as WordPress is committed to backwards compatibility. I do think once this new API is mature and in core people will stop using XML-RPC because it’s a pain to use.

What Have I Made With It?

  • Josie – A single page web app (and hopefully node.js powered mobile app) framework for use with the REST API.
  • JP-REST-API-Client – A simple client for creating and updating posts via the WordPress REST API via the WordPress HTTP API.
  • Pods JSON API – I added new routes, endpoints and documentation to the add-on to the API for Pods.
  • Pods Deploy – A tool for automating the process of moving Pods configurations between sites.
  • JP-Tax-Query – A custom endpoint for making tax queries via the REST API.
  • JP-REST-Access – A library of WordPress filters for setting cross-origin domain (CORS) headers and improving access to post endpoints.
  • JP-Rest-Cache – A soft-expiring, server-side cache for the REST API.
  • JP-Menu-Routes – Adds routes & endpoints to the REST API.
  • A basic front-end post editor, detailed in this Torque article.