Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

"API Design at GitHub". Jason Rudolph, GitHub

7,057 views

Published on

Get a behind-the-scenes look at development on the GitHub API team.

Developers and businesses rely on the stability and consistency of the GitHub API for critical tasks. Changes to the API could break production deployments (or continuous integration, authentication, etc.) for thousands of businesses. And yet, GitHub.com continues to evolve, improving existing features, and adding new ones. The GitHub API needs to evolve as well. We'll explore the design philosophies and techniques that we use to provide a reliable API, while continuing to ship improvements every day.

Published in: Technology, Design
  • Be the first to comment

"API Design at GitHub". Jason Rudolph, GitHub

  1. 1. API Design at GitHub
  2. 2.  @jasonrudolph
  3. 3.  stability and agility
  4. 4. stability
  5. 5.  Humble Beginnings { "rate": { "limit": 5000, "remaining": 4992 } } $ curl https://api.github.com/rate_limit
  6. 6.  
  7. 7.  { "rate": { "limit": 5000, "remaining": 4992 } } Some Change is Easy GET /rate_limit
  8. 8.  { "rate": { "limit": 5000, "remaining": 4992 } } Some Change is Easy GET /rate_limit { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } }
  9. 9.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } }} Some Change is Easy GET /rate_limit
  10. 10.  not all requests are created equally
  11. 11.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } }} Wither Assumptions GET /rate_limit
  12. 12.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } }} Wither Assumptions GET /rate_limit
  13. 13.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } }} Wither Assumptions GET /rate_limit { "resources": { "core": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "search": { "limit": 20, "remaining": 19, "reset": 1379361676 } } }
  14. 14.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } }} Wither Assumptions GET /rate_limit { "resources": { "core": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "search": { "limit": 20, "remaining": 19, "reset": 1379361676 } } }
  15. 15.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } }} Wither Assumptions GET /rate_limit { "resources": { "core": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "search": { "limit": 20, "remaining": 19, "reset": 1379361676 } } } $.get("https://api.github.com/rate_limit", function(data) { console.log(data["rate"]["limit"]); });
  16. 16. CC BY-NC-SA 2.0 http://flickr.com/photos/ryandonahue/2342354248
  17. 17.  { "resources": { "core": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "search": { "limit": 20, "remaining": 19, "reset": 1379361676 } } } Wither Assumptions GET /rate_limit $.get("https://api.github.com/rate_limit", function(data) { console.log(data["rate"]["limit"]); }); Uncaught TypeError: Cannot read property 'limit' of undefined
  18. 18.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } }} GET /rate_limit { "resources": { "core": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "search": { "limit": 20, "remaining": 19, "reset": 1379361676 } } } GET /rate_limit
  19. 19.  
  20. 20.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } GET /rate_limit "resources": { "core": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "search": { "limit": 20, "remaining": 19, "reset": 1379361676 } } } GET /rate_limit }} {
  21. 21.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 } GET /rate_limit "resources": { "core": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "search": { "limit": 20, "remaining": 19, "reset": 1379361676 } } } ,
  22. 22.  { "rate": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "resources": { "core": { "limit": 5000, "remaining": 4992, "reset": 1379363338 }, "search": { "limit": 20, "remaining": 19, "reset": 1379361676 } } } "limit": 5000, "remaining": 4992, "reset": 1379363338 "limit": 5000, "remaining": 4992, "reset": 1379363338 GET /rate_limit
  23. 23.  compatible > beautiful
  24. 24. stability
  25. 25. agility
  26. 26. CC BY-NC-SA 2.0 http://flickr.com/photos/ryandonahue/2342354248
  27. 27.  API + agile ?
  28. 28.  nobody reads
  29. 29.  $ curl https://api.github.com/search/code?q=bacon Be Explicit
  30. 30.  $ curl https://api.github.com/search/code?q=bacon Be Explicit { "message": "If you would like to help us test the Search API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.", "documentation_url": "http://developer.github.com/v3/search#preview-mode" } => HTTP/1.1 415 Unsupported Media Type
  31. 31.  $ curl https://api.github.com/search/code?q=bacon Be Explicit { "message": "If you would like to help us test the Search API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.", "documentation_url": "http://developer.github.com/v3/search#preview-mode" } { "message": "If you would like to help us test the Search API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.", "documentation_url": "http://developer.github.com/v3/search#preview-mode" } => HTTP/1.1 415 Unsupported Media Type
  32. 32.  { "message": "If you would like to help us test the Search API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.", "documentation_url": "http://developer.github.com/v3/search#preview-mode" } $ curl https://api.github.com/search/code?q=bacon Be Explicit { "message": "If you would like to help us test the Search API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.", "documentation_url": "http://developer.github.com/v3/search#preview-mode" } => HTTP/1.1 415 Unsupported Media Type
  33. 33.  { "message": "If you would like to help us test the Search API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.", "documentation_url": "http://developer.github.com/v3/search#preview-mode" } { "message": "If you would like to help us test the Search API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.", "documentation_url": "http://developer.github.com/v3/search#preview-mode" } $ curl https://api.github.com/search/code?q=bacon Be Explicit => HTTP/1.1 415 Unsupported Media Type
  34. 34.  $ curl https://api.github.com/search/code?q=bacon -H 'Accept: application/vnd.github.preview+json' “Open Sesame”
  35. 35.  { "total_count": 212550, "items": [ ... ] } $ curl https://api.github.com/search/code?q=bacon -H 'Accept: application/vnd.github.preview+json' “Open Sesame” => HTTP/1.1 200 OK
  36. 36.  measure
  37. 37.  evolve
  38. 38. staff-only
  39. 39. staff-only  public preview
  40. 40. staff-only  public preview  stable
  41. 41. staff-only  public preview  stable API
  42. 42. staff-only  public preview  stable API staff-only  public Browser 
  43. 43. agility
  44. 44. stability agility
  45. 45. stability agility
  46. 46.

×