JSON API

JSON API

Dd24adb5a3a430fed83a33ed552fe1b5?s=128

Paul McMahon

April 28, 2016
Tweet

Transcript

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

    MCMAHON DOORKEEPERגࣜձࣾ @PWIM
  2. େ੢઱ڕళ

  3. API'S ARE HARD

  4. CREATING A NEW API ISN'T SOMETHING YOU DO REGULARITY

  5. DIFFERENT TECHNOLOGIES MAKE DIFFERENT ASSUMPTIONS ABOUT BEST PRACTICES

  6. BACKWARDS COMPATIBILITY MAKES RESTRUCTURING HARD

  7. CONVENTION OVER CONFIGURATION

  8. DEVELOPING AN APPLICATION INVOLVES A LOT OF DECISIONS THAT DON'T

    MATTER.
  9. ALLOWS TO BUILD UP GENERALIZED TOOLING

  10. JSON API

  11. STANDARDIZES AN API'S JSON RESPONSE, SO YOU DON'T NEED TO

    THINK ABOUT IT
  12. CLIENT LIBRARIES IN JAVASCRIPT, IOS, RUBY, PHP, PERL, JAVA, ANDROID.

  13. SERVER LIBRARIES IN PHP, NODE.JS, RUBY, PYTHON, GO, .NET, JAVA,

    ELIXIR, PERL.
  14. INITIAL DRAFT IN 2013, STABLE VERSION 1.0 IN 2015

  15. 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" } } } }
  16. 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" } ] }
  17. 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" } }
  18. RESOURCES > http://jsonapi.org/ > https://github.com/rails-api/ active_model_serializers > http://emberjs.com/