Skip to content

GraphQL

GraphQL#

Intro#

  • An architectural and conceptual improvement over REST.
  • GraphQL is a data query language developed internally by Facebook in 2012 before being publicly released in 2015.
  • It provides an alternative to REST and ad-hoc webservice architectures.

REST vs GraphQL#

Lets say, we are consuming Facebook API

A typical nested field data distribution:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    FACEBOOK
    |
    |------ USERS
    |       |------- TORAN
    |                |----- INFO
    |                |       
    |                |
    |                |
    |                |----- ASSETS
    |                       |
- GraphQL can retrieve various fields from different endpoint routes in fewer or single query - whereas REST requires multiple calls for each fields - e.g. - REST
1

Terminologies#

Schema#

Field#

#

Explore#

Forming Calls With GraphQL#

Authenticating with GraphQL#

The GraphQL endpoint#

Communicating with GraphQL#

About query and mutation operations#

Working with variables#

Query#

Mutation#