In this talk from A Day of REST, Joe Hoyle discusses the building blocks of a WordPress REST API project, and how you can leave admin ajax behind.
Joe Hoyle is the CTO of Human Made, one of the lead developers of the WordPress REST API, and with the second talk at A Day of REST he discussed the building blocks of a REST API project. You can view all videos as we publish them on the A Day of REST video archive.
Joe has built a number of projects with REST APIs, including Happytables and Nomad Base. To get things started, he comes out of left field by comparing RESTful projects with the computer game, Age of Empires. He said it’s like exploring an unknown landscape, where you want to look around and get a feel for what’s out there and what tools you have available to you.
The REST API consists many different components, “and tangentially related things. It’s not just learning the REST API.” But you have to learn a variety of tools and stuff related to the API in order to best make use of it.
Once we’re done, our application might look something like this:
And as the API evolves, it changes, tools evolve, and you have to stay on top of that landscape. So even though you learned it once, you can’t rest on your laurels. So Joe wanted to identify what types of things you need to keep an eye on in projects that utilize the REST API.
Most projects start with some kind of signup, or registration. For Nomad Base, that then turns into a user-generated map. In their case, that meant showcasing the map with a WordPress theme, and a template to utilize the proper markup. That happens with PHP, maybe a little jQuery, and admin ajax — nothing too difficult.
And other developers can follow that paradigm as well. With admin ajax, “all of the interfaces are disparate.” The REST API helps standardize how to interact dynamically with the website.
The building blocks of a project with the REST API at the center can go from being very few to being many, but with the REST API in place, WordPress developers can abandon admin ajax and all its problems for a centralized core component where all data can be managed — and then utilized across many applications: from the CMS, to a mobile app, to dynamic interactions with third parties, and more.
Check out Joe’s slides while you watch the video, and be sure to follow him on Twitter as well — because every now and then he’ll share a Github Gist of something awesome he’s working on with the API. Joe is also the co-host of the Draft WordPress Podcast with me, so you should subscribe to it and listen to us chatter every week, where we almost always mention the REST API.
The videos at A Day of REST were shot and edited by Rhys Alexander. The conference was organized by Human Made, and you can stay up to date with A Day of REST — which is going to Boston — and learn about other potential future events. There were eight great talks at A Day of REST, and you can read my review of the event as a whole, and look out for the next video to be posted here soon.