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

API Realtalk

API Realtalk

Experience learned from both sides of consuming and building APIs at GitHub.

Wynn Netherland

October 24, 2013
Tweet

More Decks by Wynn Netherland

Other Decks in Technology

Transcript

  1. GET /me? HTTP/1.1 200 OK Server: example.com Content-Type: application/json; charset=utf-8

    Connection: keep-alive Status: 200 OK Developer hears: :OK
  2. GET /me? HTTP/1.1 200 OK Server: example.com Content-Type: application/json; charset=utf-8

    Connection: keep-alive Status: 200 OK Developer hears: :OK
  3. GET /me? HTTP/1.1 500 INTERNAL SERVER ERROR Server: example.com Content-Type:

    application/json; charset=utf-8 Connection: keep-alive Status: 500 INTERNAL SERVER ERROR
  4. GET /me? HTTP/1.1 500 INTERNAL SERVER ERROR Server: example.com Content-Type:

    application/json; charset=utf-8 Connection: keep-alive Status: 500 INTERNAL SERVER ERROR Developer hears: :DOH
  5. GET /me? HTTP/1.1 500 INTERNAL SERVER ERROR Server: example.com Content-Type:

    application/json; charset=utf-8 Connection: keep-alive Status: 500 INTERNAL SERVER ERROR Developer hears: :DOH
  6. GET /me? HTTP/1.1 403 FORBIDDEN Server: example.com Content-Type: application/json; charset=utf-8

    Connection: keep-alive Status: 403 FORBIDDEN Developer hears: :NOPE
  7. GET /me? HTTP/1.1 302 FOUND Server: example.com Content-Type: application/json; charset=utf-8

    Connection: keep-alive Status: 302 FOUND Location: https://example.com/over/there !
  8. GET /me? HTTP/1.1 302 FOUND Server: example.com Content-Type: application/json; charset=utf-8

    Connection: keep-alive Status: 302 FOUND Location: https://example.com/over/there Developer hears: :WAT
  9. /302 me The requested resource resides temporarily under a different

    URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache- Control or Expires header field.
  10. curl -I https://api.github.com/users/defunkt ! HTTP/1.1 200 OK Server: nginx Date:

    Wed, 12 Sep 2012 14:07:43 GMT Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 200 OK Content-Length: 692 X-Content-Type-Options: nosniff X-RateLimit-Remaining: 4997 X-RateLimit-Limit: 5000 Cache-Control: public, s-maxage=60, max-age=60 Vary: Accept X-GitHub-Media-Type: github.beta ETag: "ef742caec0c19e2169ffb05e7d200d17" Last-Modified: Tue, 11 Sep 2012 02:52:21 GMT
  11. curl -I https://api.github.com/users/defunkt ! HTTP/1.1 200 OK Server: nginx Date:

    Wed, 12 Sep 2012 14:07:43 GMT Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 200 OK Content-Length: 692 X-Content-Type-Options: nosniff X-RateLimit-Remaining: 4997 X-RateLimit-Limit: 5000 Cache-Control: public, s-maxage=60, max-age=60 Vary: Accept X-GitHub-Media-Type: github.beta ETag: "ef742caec0c19e2169ffb05e7d200d17" Last-Modified: Tue, 11 Sep 2012 02:52:21 GMT Fingerprint
  12. curl -I \ -H 'If-None-Match:"ef742caec0c19e2169ffb05e7d200d17" \ https://api.github.com/users/defunkt ! HTTP/1.1 304

    Not Modified Server: nginx Date: Wed, 12 Sep 2012 15:51:39 GMT Connection: keep-alive Status: 304 Not Modified X-RateLimit-Limit: 5000 X-Content-Type-Options: nosniff Vary: Accept ETag: "ef742caec0c19e2169ffb05e7d200d17" X-RateLimit-Remaining: 4997 Last-Modified: Wed, 12 Sep 2012 01:38:14 GMT Cache-Control: public, s-maxage=60, max-age=60
  13. $ curl -i https://api.github.com/user HTTP/1.1 200 OK Cache-Control: private, max-age=60

    ETag: "644b5b0155e6404a9cc4bd9d8b1ae730" Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT Status: 200 OK Vary: Accept, Authorization, Cookie X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4996 ! $ curl -i https://api.github.com/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT" ! HTTP/1.1 304 Not Modified Cache-Control: private, max-age=60 Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT Status: 304 Not Modified Vary: Accept, Authorization, Cookie X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4996 ! $ curl -i https://api.github.com/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"' ! HTTP/1.1 304 Not Modified Cache-Control: private, max-age=60 ETag: "644b5b0155e6404a9cc4bd9d8b1ae730" Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT Status: 304 Not Modified Vary: Accept, Authorization, Cookie X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4996
  14. Attribution Hand designed by Naomi Atkinson from The Noun Project

    Cereal designed by Jacob Halton from The Noun Project Evil designed by Jim Lears from The Noun Project Console designed by Austin Andrews from The Noun Project Report designed by Doug Cavendish from The Noun Project Television designed by Piero Borgo from The Noun Project Person designed by Paulo Sá Ferreira from The Noun Project Detour designed by Dmitry Baranovskiy from The Noun Project Mime designed by Jonathan C. Dietrich from The Noun Project