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

WCNYC2014

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

 WCNYC2014

Avatar for Ryan McCue

Ryan McCue

August 03, 2014
Tweet

More Decks by Ryan McCue

Other Decks in Programming

Transcript

  1. JSON { "ID": 4, "title": "My Awesome Post", "content": "This

    is my awesome content!" } JavaScript Object Notation • Supported by basically everything • Human readable • Standard
  2. REST Actions applied to Resources Create POST Read GET Update

    PUT Delete DELETE Uses HTTP actions: Representational State Transfer
  3. REST Representational State Transfer /posts /posts/4 /posts /posts/4 /posts/4 GET

    GET POST PUT DELETE Action
 (Verb) Resource
 (Object)
  4. API Or extend as needed! GET POST PUT DELETE Posts

    ✔ ✔ ✔ ✔ Pages ✔ ✔ ✔ ✔ Custom Post Types ✔ ✔ ✔ ✔ Post Meta ✔ ✔ ✔ ✔ Media ✔ ✔ ✔ ✔ Comments ✔ ✔ Taxonomies/Terms ✔ ✔ ✔ ✔ Users ✔ ✔ ✔ ✔
  5. Jetpack API Easy for developers Works with Javascript easily (JSON-based)


    Requires Jetpack active Depends on WordPress.com Does not work for local development Cannot control access to certain apps
  6. { "name": "WP API Dev", "description": "Just another WordPress site",

    "URL": "http://local.wpapi.dev", "routes": {}, "authentication": [], "meta": {} } /wp-json/ GET
  7. [{ "ID": 110, "title": "Testing sticky", "status": "publish", "type": "post",

    "author": {}, "content": "<p>this should be stuck as a post. Stuck on you.</p>\n", "link": "http://local.wpapi.dev/testing-sticky/", "date": "2014-06-02T10:47:39-05:00", "modified": "2014-06-02T10:47:39-05:00", "format": "standard", "slug": "testing-sticky-2", "guid": "http://local.wpapi.dev/testing-sticky-2/", "excerpt": "<p>this should be stuck as a post. Stuck on you.</p>\n”, "comment_status": "open", "sticky": true, "meta": {}, "featured_image": null, "terms": {} }] /wp-json/posts GET
  8. { "ID": 1, "title": "Hello World!", "status": "publish", "type": "post",

    "author": {}, "content": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>\n", "link": "http://local.wpapi.dev/hello-world/", "date": "2014-04-18T15:14:46-05:00", "modified": "2014-05-02T01:26:30-05:00", "format": "standard", "slug": "hello-world", "guid": "http://local.wpapi.dev/?p=1", "excerpt": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>\n", "comment_status": "open", "meta": {}, "featured_image": null, "terms": {} } /wp-json/posts/1 GET
  9. Resources JSON REST API Plugin:
 github.com/WP-API/WP-API ! OAuth1 Authentication Plugin:

    
 github.com/WP-API/OAuth1
 Basic Authentication Plugin: 
 github.com/WP-API/Basic-Auth ! API Console:
 github.com/WP-API/api-console JSON REST API
  10. Resources JS Client:
 github.com/WP-API/client-js ! PHP Client: 
 github.com/WP-API/client-php 


    WP-CLI Client: 
 github.com/WP-API/client-cli JSON REST API Clients