Intro to the WordPress REST API


Last Monday I presented a talk on the awesome WordPress REST API at WordPress Meetup Antwerp, the API where lots of people were waiting for some time and is available since last year. I myself went to London end of January for a Day Of Rest, a conference completely dedicated to WordPress and the many usages of the REST API, how it came to be and what the possibilities and pitfalls are when deploying it in a real project.

So far, I only dabbled with it in test environments and making it power some trials in Angular or React.

Last month I demo’ed some possibilities with AJAX in WordPress, so a follow-up about the REST API was kinda logical. But since I noticed in that demo that the majority of the folks are not that into frontend development, I had to be careful not to overload and possibly confuse the audience.

So I decided to go with an “intro to the WP REST API”, explaining in the process what an API is, what kind of existing APIs already exist in WordPress, what REST is, how it relates to the WWW, some examples (e.g. the social networks’ REST APIs) and how they prove very useful in handling data, platform-agnostic.

And showed some demo’s where I simply showed them the JSON object which gets returned upon fetching posts via a few simple lines of JavaScript. How they simply can be manipulated client-side, and how also pages, users, comments etc can be fetched (I didn’t go into creating,updating or deleting content).

And I showed the power of a REST API in combination with a frontend JS MVC Framework by a little Angular JS demo and the Calypso project. And showed them the objective that this project fulfilled, namely a better, smoother interface, better handling, desktop instead of webbased and the ability of handling multiple sites in one interface. And on the dev-side the fact that this project is completely open-sourced so lessons could be drawn on howto build a similar app with the WP REST API.

All in all a fairly broad overview without going too much in-depth — probably keep that for a follow-up presentation, probably at WordCamp Antwerp in June — mainly focusing on possibilities and the changing paradigm of webdesign (which some people visibly shocked — “Is PHP going to be useless?” — (it isn’t, or not soon anyway..) ).

Got a lot of reactions and questions afterwards, so I think I certainly triggered some people.

Without further ado, here are the slides. Of course it’s better to hear the talk along with it, but they’re pretty self-explanatory.

XHTML: You can use these tags: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>