Getting Started with

@coderkevin

https://github.com/coderkevin

Kevin Killingsworth

  • Introduction to the API
  • Define related terms and technology
  • Step through example code
  • Provide resources to get started!

Follow along: http://bit.do/wp-api-slides

Connect to your WordPress data

directly!

REST API v2

REST API v1

XML-RPC

A little history...

What is REST?

REpresentational

State

Transfer

The URL represents what you want to do

GET /wp/v2/posts
POST /wp/v2/comments/<id>

JSON

JavaScript Object Notation

Escher?

Everyone's doing it!

{
  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true,
  "age": 25,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021-3100"
  },
  "phoneNumbers": [
    {
      "type": "home",
      "number": "212 555-1234"
    },
    {
      "type": "office",
      "number": "646 555-4567"
    },
    {
      "type": "mobile",
      "number": "123 456-7890"
    }
  ],
  "children": [],
  "spouse": null
}

Platforms

Languages

+

"I believe quite strongly that JavaScript and API-driven interfaces are the future of not just WordPress but the web" -- Matt Mullenweg

Authentication

It's your content.

REST API (v2)

HTTP

JSON

Browser

JavaScript

External Web App

JSON

JavaScript?

PHP?
Python?

Ruby?

Java?

C/C++?

JSON

Mobile Device

Let's get to the code...

https://github.com/coderkevin

http://bit.do/api-example

Resources

Made with Slides.com