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

GitHub GraphQL API

GitHub GraphQL API

359024e7132672aaeef4a3e792be4ae5?s=128

Brooks Swinnerton

September 13, 2016
Tweet

Transcript

  1. GitHub GraphQL API Brooks Swinnerton

  2. Hi, I’m Brooks

  3. I work at !

  4. Today I want to talk about our API

  5. March 11, 2008

  6. April 8, 2011

  7. today’s REST API

  8. is endpoint driven

  9. is verb driven

  10. None
  11. /repos/:owner/:name/projects ʦʒʒʪ
 verb ʦʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʪ
 endpoint GET

  12. [ { "owner_url": "https://api.github.com/repos/bswinnerton/weekend-project", "url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/1", "id": 166, "name": "The

    Website", "body": "The main website powering my weekend hack project.", "number": 1, "creator": { "login": "bswinnerton", "id": 934497, "avatar_url": "https://avatars2.githubusercontent.com/u/934497?v=3", "gravatar_id": "", "url": "https://api.github.com/users/bswinnerton", "html_url": "https://github.com/bswinnerton", "followers_url": "https://api.github.com/users/bswinnerton/followers", "following_url": "https://api.github.com/users/bswinnerton/following{/ other_user}", "gists_url": "https://api.github.com/users/bswinnerton/gists{/gist_id}", "starred_url": "https://api.github.com/users/bswinnerton/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/bswinnerton/subscriptions", "organizations_url": "https://api.github.com/users/bswinnerton/orgs", "repos_url": "https://api.github.com/users/bswinnerton/repos", "events_url": "https://api.github.com/users/bswinnerton/events{/privacy}", "received_events_url": "https://api.github.com/users/bswinnerton/ received_events", "type": "User", "site_admin": true }, "created_at": "2016-09-13T05:25:42Z", "updated_at": "2016-09-13T05:36:56Z" } ]
  13. /repos/:owner/:name/projects/:number/columns ʦʒʒʪ
 verb ʦʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʪ
 endpoint GET

  14. [ { "project_url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/1", "id": 522, "name": "Up Next", "created_at":

    "2016-09-13T05:25:48Z", "updated_at": "2016-09-13T05:31:05Z" }, { "project_url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/1", "id": 523, "name": "In Flight", "created_at": "2016-09-13T05:25:52Z", "updated_at": "2016-09-13T05:34:30Z" }, { "project_url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/1", "id": 524, "name": "Awaiting Review", "created_at": "2016-09-13T05:26:01Z", "updated_at": "2016-09-13T05:36:56Z" }, { "project_url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/1", "id": 525, "name": "Done", "created_at": "2016-09-13T05:26:05Z", "updated_at": "2016-09-13T05:35:39Z" } ]
  15. /repos/:owner/:name/projects/columns/:id/cards ʦʒʒʪ
 verb ʦʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʒʪ
 endpoint GET

  16. [ { "column_url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/ columns/525", "id": 2408, "note": null, "created_at":

    "2016-09-13T05:34:27Z", "updated_at": "2016-09-13T05:34:27Z", "content_url": "https://api.github.com/repos/bswinnerton/weekend-project/issues/2" }, { "column_url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/ columns/525", "id": 2410, "note": "Find cofounders", "created_at": "2016-09-13T05:35:09Z", "updated_at": "2016-09-13T05:35:09Z" }, { "column_url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/ columns/525", "id": 2409, "note": "Buy domain name", "created_at": "2016-09-13T05:34:43Z", "updated_at": "2016-09-13T05:34:43Z" }, { "column_url": "https://api.github.com/repos/bswinnerton/weekend-project/projects/ columns/525", "id": 2402, "note": "Set up Slack", "created_at": "2016-09-13T05:26:20Z", "updated_at": "2016-09-13T05:26:20Z" } ]
  17. this can be painful

  18. each request counts against a rate limit

  19. data you don’t need

  20. which brings us to tomorrow

  21. September 14, 2016

  22. built on GraphQL

  23. what is GraphQL?

  24. a query language

  25. created by Facebook

  26. query {
 viewer {
 name
 }
 }

  27. query {
 viewer {
 name
 }
 } { "data": {

    "viewer": { "name": "Brooks" } } }
  28. it’s introspectable

  29. it’s typed

  30. let’s take it for a spin

  31. !

  32. why GraphQL?

  33. you get the data you need

  34. in one request

  35. you get the data you need

  36. when new UI features are released

  37. we use GraphQL in production

  38. early access

  39. we want your feedback

  40. which schemas do you need?

  41. where can we offer better tooling?

  42. what’s confusing about the GraphQL API?

  43. Learn more Check out tomorrow’s talk: Updating our Platform to

    help integrators ship
 http://githubengineering.com 
 https://developer.github.com
 
 https://platform.github.community
  44. https://developer.github.com

  45. https://platform.github.community

  46. Come find us

  47. Q&A

  48. FIN