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

...And GraphQL for All? A few things to think about before blindly dumping REST for GraphQL

...And GraphQL for All? A few things to think about before blindly dumping REST for GraphQL

GraphQL is new. GraphQL is cool. Look! Github dumped REST for it! We MUST do it too! Well, why not. GraphQL could be a great tool, but like any tool, you don't choose it "just because".You choose it because it solves a problem in a given context. You choose it knowing its strengths and weaknesses.

During this session, while discovering what is GraphQL we will see what REST API providers should think about before blindly dumping REST for it. From design and implementation to pricing model and analytics down to developers experience and implementations, choosing an API design style will have impact on the whole API lifecycle. Therefore, this choice must be an enligthned one and not based on simple beliefs.

Arnaud Lauret API Handyman

December 13, 2016
Tweet

More Decks by Arnaud Lauret API Handyman

Other Decks in Technology

Transcript

  1. … and GraphQL for all? a few things to think

    about before blindly dump REST for GraphQL
  2. { me: viewer { fullname: name picture: avatarURL repositories( first:

    2, orderBy: {field: CREATED_AT, direction: DESC}) { edges { node { name }}}}}
  3. { "data": { "me": { "fullname": "Arnaud Lauret", "picture": "https://avatars0.githubus...",

    "repositories": { "edges": [ {"node": { "name": "apistylebook-api"} }, { "node": { "name": "restfest-videos-data"}} ] }}}}
  4. { me: viewer { name avatarURL } kin: user(login: "kinlane")

    { name avatarURL } mike: user(login: "mamund") { name avatarURL } graphqlRepos: search( first: 5, query: "graphql", type: REPOSITORY) { edges { node { ... on Repository { name description }}}} }
  5. { "data": { "me": { "myFirstTwoRepos": { "edges": [ {

    "repo": { "name": "a-repo" } } ] }}}} { "data": { "me": { "myFirstTwoRepos": [ {"name": "a-repo"} ] }}} X
  6. • Data you need • Less data volume • Less

    API calls • Schema • Providers and consumers tools
  7. query { user(id: "{id}") { name } } mutation {

    } Inconsistency & Unpredictability deleteUser(id: "{id}") removeUser(id: "{id}") suppressPeople(id: "{id}")
  8. • More flexibility • Less predictability and consistency • Less

    guidance in process • More Responsability
  9. “If you suck at providing REST API You’ll suck at

    providing GraphQL API” Arnaud Lauret, @apihandyman