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

Introduction to GraphQL

Introduction to GraphQL

Learn about GraphQL, how it works, and how to use it.

Adrián Matellanes

September 23, 2017
Tweet

More Decks by Adrián Matellanes

Other Decks in Programming

Transcript

  1. GET https://2017.es.pycon.org/speakers/me { "name": "Adrián Matellanes", "roles": [ "Lead API

    Developer", "Málaga Python Organizer" ], "worksAt": "Ebury", "twitter": "@_amatellanes", "github": "github.com/amatellanes" }
  2. "url": "http://anapioficeandfire.com/api/characters/583", "name": "Jon Snow", "culture": "Northmen", "born": "In 283

    AC", "titles": [ "Lord Commander of the Night's Watch" ], "aliases": [ "Lord Snow", "Ned Stark's Bastard", "The Snow of Winterfell", "The Bastard of Winterfell", "Lord Crow" ], "allegiances": [ "http://anapioficeandfire.com/api/houses/362" ], "books": [ "http://anapioficeandfire.com/api/books/5" ], "povBooks": [ "http://anapioficeandfire.com/api/books/1", "http://anapioficeandfire.com/api/books/2", "http://anapioficeandfire.com/api/books/3", "http://anapioficeandfire.com/api/books/8"
  3. Created July 1, 2015 Updated September 20, 2017 381 Forks

    6,078 Stars 302 Commits 82 Open Issues https://github.com/facebook/graphql
  4. type Character { name: String! house: House! } type House

    { name: String! words: String! members: [Character]! }
  5. type Character { name: String! house: House! } type House

    { name: String! words: String! members: [Character]! } Object Type
  6. type Character { name: String! house: House! } type House

    { name: String! words: String! members: [Character]! } Fields
  7. type Character { name: String! house: House! } type House

    { name: String! words: String! members: [Character]! } Return Types
  8. query CharactersNameAndHouse { allCharacters { name house { words }

    } } { "data": { "allCharacters": [ { "name": "Daenerys Targaryen", "house": { "words": "Fire and Blood" } }, { "name": "Jon Snow", "house": { "words": "Winter Is Coming" } } ] } }
  9. mutation CharacterMutation { createCharacter(name: "Sansa Stark") { name } }

    { "data": { "createCharacter": { "name": "Sansa Stark" } } }
  10. subscription NewCharacterSubscription { newCharacter { name } } { "data":

    { "newCharacter": { "name": "Tyrion Lannister" } } }
  11. QUERY getHouse(id: 5) { name, words, members } HOUSE name

    words members [ { name }, { name } ] name name
  12. QUERY getHouse(id: 5) { name, words, members } HOUSE name

    words members [ { name }, { name } ] CHARACTER name name
  13. { "data": { "__type": { "name": "Book", "kind": "OBJECT", "fields":

    [ { "name": "title", "type": { "name": "String" } } ] } } } { __type(name: "Book") { name kind fields { name type { name } } } }
  14. Created September 24, 2015 Updated September 20, 2017 229 Forks

    2,356 Stars 1,219 Commits 87 Open Issues https://github.com/graphql-python/graphene
  15. "It’s important to understand that it isn’t all or nothing.

    GraphQL is in our future, but it isn’t our exclusive future."