2016 Conference

Give it a REST: Using the WordPress JSON REST API

Have you ever wanted to pull data out of your LDAP system and use it in your WordPress site? How about pulling data from WordPress to use in another system or in a mobile app? Or using structured data from a non-WordPress source in your CMS? The REST JSON API may help you to do what you’re looking for.

29960265985_3f44730332_bREST stands for REpresentational State Transfer, a structured way of sending data across the web. WordPress 4.4 and above has some basic support for REST, but you’ll need to use some plugins to get the most out of this technology — most importantly, the WP API plugin. Other plugins are recommended for handling authentication (sometimes, you may want to get non-public data out of WordPress, or even write new data into WP) and the SearchWP API Route plugin (to help create custom endpoints).

The REST API returns standard structured JSON that can be delivered in a more granular way than something like RSS, so you can use it not only to display data, but to bring logic to the content that you’re displaying. While there are some challenges to implementation (especially building in authentication, and writing your own¬†endpoints for custom fields content), diving in with a simple project that’s only using public data may be a good way for you to get started.

Curtiss shared both a link to his slide deck, as well as some example code on GitHub that should help you get an idea of how you can get started hands-on with REST in WordPress.

Curtiss Grymala
Senior Web Technologist, University of Mary Washington

Photo Credit: ThoroughlyReviewed Flickr via Compfight cc

Share this: