Sharing the Love: Leveraging the WordPress REST API to Syndicate Content

Brian Hoke

@bentleyhoke | www.bentleyhoke.com

The WordPress REST API

  • What is it?
  • What can we do with it?
  • Why?
  • Case Study
  • What next?

WP-REST API – What Is It?

Endpoints

  • http verb + endpoint
  • GET /wp-json/posts – all posts
  • GET /wp-json/posts/184 – one post
  • POST /wp-json/posts with authentication and
    postcontents = {
    :title => ‘My New Post’,
    :status => ‘publish’,
    :content_raw => ‘<p>Body content</p>’
    }

Authentication

Docs

Why?

  • Decoupling
  • Security
  • Performance
  • TCO
  • Leveraging team’s various talents – Rails developer, Node.js developer, WP developer, etc.

Use Case

  • Members of company deliver talks at WordCamps
  • Need: presentations (Reveal.js, WP pages)
  • Need: post notes (Rails, OAuth, Geolocation API)
  • Need: display posts (Node.js)

Use Case

diagram

Displaying Presentations – PHP/JS

Authoring Notes – Rails, OAuth

  • Ruby on Rails
  • OAuth authentication
  • Geolocation API generates static Google Map

Displaying Notes: Node.js

What’s Next?

  • integration into core
  • schema, version, endpoint consistency
  • go forth and build it

Questions?

Brian Hoke

@bentleyhoke | www.bentleyhoke.com