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

The WordPress REST API: A game changer for Word...

Silvan Hagen
November 18, 2016

The WordPress REST API: A game changer for WordPress

The WordPress REST API is finally coming to Core in 4.7 (December 2016). This talk is a brief introduction on the concept of REST and the WP REST API. Additionally it's a showcase of the exciting new things you'll be able to build on top of the WordPress REST API.

Talk held at WordCamp Geneva 2016: https://2016.geneva.wordcamp.org

Additional links to the slides: https://goo.gl/N4RQ6N

Silvan Hagen

November 18, 2016
Tweet

More Decks by Silvan Hagen

Other Decks in Technology

Transcript

  1. REpresentational State Transfer - Not any smarter yet? Well me

    neither ¯\_(ツ)_/¯ - It’s about resources & a little bit about verbs - Uses HTTP methods in a specific way
  2. REST: Let’s have a look GET /friends => Returns a

    Collection of friends GET /friends/joe => Returns a single friend GET /friends/new => Could be a form to add a friend
  3. The HTTP methods in REST GET /friends => READ POST

    /friends => CREATE PUT /friends => UPDATE DELETE /friends => DELETE The famous CRUD
  4. What about REST and WordPress? GET /wp-json/wp/v2/posts => Collection of

    Posts GET /wp-json/wp/v2/posts/<id> => Singular Post GET /wp-json/ => Allows discovering the API
  5. How did we get here? - Started as GSoC project

    in 2013 by Ryan McCue - Infrastructure merged into WP 4.4 in 2015 - Content Endpoints merged into WP 4.7 in 2016
  6. API Discovery via Response Header - In the response header

    of a request: Link: <http://example.com/wp-json/>; rel="https://api.w.org/"
  7. Some more Ideas - Mobile Apps - Other technologies can

    consume WP in a standardised way - New Admin Interfaces - Meta Boxes in the backend - All the lame admin-ajax.php stuff - WP_List_Tables - Customizer - Data heavy widgets - Comments (cool once comment type is merged) - Links & more: https://goo.gl/N4RQ6N