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

API Design

azisaka
March 04, 2013

API Design

A keynote made for Papaya Ventures explaining the main points when developing an API.

azisaka

March 04, 2013
Tweet

More Decks by azisaka

Other Decks in Technology

Transcript

  1. Se aproveite dos HTTP methods GET /posts.json POST /posts.json GET

    /posts/1.json PUT /posts/1.json DELETE /posts/1.json
  2. Indiquem onde o resultado está GET /posts { “posts”: [

    { “id”: 1, title: “Post #1” }, { “id”: 2, title: “Post #2” } ], “page”: 1, “total”: 10, “perPage”: 2 } GET /posts?page=2&perPage=1 { “posts”: [ { “id”: 3, title: “Post #3” }, ], “page”: 2, “total”: 10, “perPage”: 1 }
  3. Reduza o payload GET /posts/1 { “post”: { “id”: 1,

    “title”: “Post #1”, “body”: “Post’s body”, “tags”: [“api”, “web”, “http”], “category”: { “name”: “Development” } } } GET /posts/1?fields=id,title { “post”: { “id”: 1, “title”: “Post #1” } }
  4. E mantenha ao menos 1 versão GET /v1/posts/1 GET /v2/posts/1

    { “post”: { “id”: 1, “title”: “Post #1”, “content”: “Post’s body” } } } { “post”: { “id”: 1, “title”: “Post #1”, “body”: “Post’s body” } } }