Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The WordPress REST API

Jack Lenox
January 13, 2015

The WordPress REST API

A talk that I gave at WordPress Cumbria in Kendal on Tuesday 13 January 2015.

Jack Lenox

January 13, 2015
Tweet

More Decks by Jack Lenox

Other Decks in Technology

Transcript

  1. REST API • REST stands for REpresentational State Transfer •

    API stands for Application Programming Interface • Probably the optimal word in all of this is Interface • A REST API gives you a new way of accessing your blog/site’s data
  2. The PHP API • Gives you ‘the loop’ • the_post(),

    the_title(), the_content(), the_date() etc etc. • It’s how developers have interacted with WordPress since day one • The problem here is that you pretty much have to use PHP
  3. The WordPress REST API • Several have popped up over

    the years • The now-official WordPress.org one has been forked from a plugin called ‘JSON API’ • This was first released in the plugin repository in 2009 • It was built as part of a project for the MoMA in New York. The project used Ruby on Rails. They had a Ruby on Rails frontend and a WordPress backend. • Due in WordPress core at some point (hopefully this year)
  4. – Trek Glowacki, Core Team, Ember “Since the start of

    the web, for every interaction there have been two supercomputers involved. The supercomputer sitting in front of you and the supercomputer in a data centre somewhere. We have barely begun to take advantage of that supercomputer sitting in front of you.”
  5. What is an SPA? • As opposed to multipage web

    application • Has only one initial page load • When done well, provides a more continuous, fluid user experience
  6. The times are a-changin’ • This is nothing new •

    WordPress themes and plugins have been steadily doing more and more • It is relatively straightforward to have SPA elements within a multipage web application • Backbone has been included in WordPress core since 2012
  7. So what can I actually do with the REST API?

    • REST APIs centre around a series of verbs • GET, POST, PUT, DELETE • GET posts/pages/comments etc. • Edit and add posts/pages/comments via POST • DELETE posts/pages/comments etc.
  8. FIN