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

JSON API

JSON API

Paul McMahon

April 28, 2016
Tweet

More Decks by Paul McMahon

Other Decks in Technology

Transcript

  1. JSON API A SPECIFICATION FOR BUILDING APIS IN JSON PAUL

    MCMAHON DOORKEEPERגࣜձࣾ @PWIM
  2. BASIC EXAMPLE GET /events/42716 { "data": { "type": "events", "id":

    "1", "attributes": { "title": "Machida Tech Night" "starts_at": "2016-04-28T10:00:00.000Z" "ends_at": "2016-04-28T12:30:00.000Z" }, "relationships": { "data": { "type": "group", "id": "6918" } } } }
  3. SPARE FIELDSETS & RELATIONSHIPS GET /events/42716?include=group { "data": { "type":

    "events", "id": "1", "attributes": { "title": "ୈ3ճ Machida Tech Night" }, "relationships": { "data": { "type": "group", "id": "6918" } } }, "included": [ { "type": "group", "id": "6918", "attributes": { "name": "Machida Tech Night" } ] }
  4. PAGINATION & FILTERING GET /events?filter[title]=Machida&page[number]=2&page[size]=1 { "meta": { "total-pages": 3

    }, "data": [{ "type": "events", "id": "1", "attributes": { "title": "ୈ3ճ Machida Tech Night" }, "relationships": { "data": { "type": "group", "id": "6918" } } }], "links": { "self": "https://api.doorkeeper.jp/events?filter[title]=Machida&page[number]=2&page[size]=1", "first": "https://api.doorkeeper.jp/events?filter[title]=Machida&page[number]=1&page[size]=1", "prev": "https://api.doorkeeper.jp/events?filter[title]=Machida&page[number]=1&page[size]=1", "next": "https://api.doorkeeper.jp/events?filter[title]=Machida&page[number]=3&page[size]=1", "last": "https://api.doorkeeper.jp/events?filter[title]=Machida&page[number]=3&page[size]=1" } }