$30 off During Our Annual Pro Sale. View Details »

Building good Web APIs

Building good Web APIs

Talks about the importance of good web API, show best practices, show worst practices (and argue why they're bad), and hopefully convince the audience to pay attention whenc reating APIs even if "nobody but devs can see it".

Senko Rašić

October 04, 2014
Tweet

More Decks by Senko Rašić

Other Decks in Programming

Transcript

  1. the making of
    !
    A good Web API
    !
    how and why
    Senko Rašić, Good Code

    View Slide

  2. We’re hiring!

    View Slide

  3. View Slide

  4. Image credit: agileapps.co.uk

    View Slide

  5. RFC2616

    View Slide

  6. GET /service?cmd=delete&type=author&id=5
    !
    GET /authors/
    HEAD /authors/5
    !
    POST /authors/
    PUT /authors/5
    PATCH /authors/5
    DELETE /authors/5

    View Slide

  7. 200 OK!
    201 Created!
    202 Accepted!
    204 No Content!
    !
    400 Bad Request!
    401 Not Authorized!
    403 Forbidden!
    404 Not Found!
    405 Method Not Allowed!
    !
    503 Service Unavailable

    View Slide

  8. Cookie: sessionid=249d67c74be
    !
    !
    Authorization: token efdf537eb7

    View Slide

  9. HTTPS

    View Slide

  10. lock down your API framework

    View Slide

  11. /authors ↔ /books/

    View Slide

  12. /api/v1/foo
    /api/v2/foo

    View Slide

  13. View Slide

  14. Consistency
    Backwards compatibility
    Use HTTP(S)
    !
    Developer experience matters

    View Slide

  15. Web of Zygiella spiders after high doses of caffeine!
    Image credit: P. N. Witt, Ch. F. Reed & D. B. Peakall, “A Spider's Web”
    Thank you

    View Slide