Key Terms used in GraphQL

GraphQL is query language for API. GraphQL gives client the power to ask for exactly what data they need. With GraphQL, we can easily write API. Facebook's mobile apps have been powered by GraphQL since 2012.
Its community is growing fast, and it's probably the most popular alternative to the good old REST APIs.

Practically, GraphQL is only a specification, and it has different implementations for different languages like Go, Javascript, Java, Python, etc.

Key terms in GraphQL

  • Type: Type is the basic building block of graphql. It consists of fields

  • Field: Field is similar to property in other language like Java, Python, etc. For eg, id, firstName, lastName, address, phoneNumber, etc.

  • Query: Query is request to read data from the server. GraphQL queries are equivalent to GET request.

  • Mutation: Mutation is request to write/change data on the server. GraphQL mutations can be used to make the equivalent of POST, PUT, PATCH, and DELETE requests.

  • Subscription: Unlike queries and mutations, which are request-response-based, subscriptions allow clients to subscribe to specific events or data changes. Subscription is a way to receive real-time data updates from the server over long-lived connection. There are clients which subscribes to a particular event and receive updates in real-time.

  • Schema: Schema defines the available types, queries, mutations, and subscriptions that clients can use to interact with the API.

  • Resolver: Resolver provides instructions for converting a Graphql request(query, mutation or subscription) into data. A Resolver is a function.

  • Arguments: Arguments are data passed to queries or mutations.