Introducing GraphQL – what, when, and why
In this section, we will explore what GraphQL is. According to graphql.org, the official definition of GraphQL is that “GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.” Let’s dive a bit deeper to understand GraphQL.
Representational State Transfer (REST) has been the standard way of publishing data across systems, which is platform, device, and tool/language-agnostic. However, there are two major bottlenecks with REST:
- For fetching different related entities, we need multiple REST requests. We must also be mindful of different versions of the API. Having different endpoints and their versions for each entity of functionality is a maintenance headache.
- The request and response parameters are always fixed in REST. For example, there is a REST API that returns 100 fields. Suppose there is a consumer who only needs 10 fields. However, since responses...