GraphQL
A query language and runtime for APIs in which clients request exactly the fields they need from a typed schema.
GraphQL lets web and mobile front ends get the data a screen needs in one request, reducing over-fetching and the number of endpoint changes product teams must wait for.
A headless commerce storefront sends one GraphQL query for a product page asking for name, price, three images and stock by warehouse, instead of calling four REST endpoints and discarding unused fields.
Flexible queries make caching harder than with URL-based REST and allow expensive nested requests, so servers need depth limits, cost analysis or persisted queries. For simple APIs it adds schema and resolver work.
A GraphQL service publishes a schema of types, including objects, scalars, enums, interfaces, unions and input types, with a required query root type. Clients send queries to read data, mutations to write and subscriptions for event streams, usually over HTTP to a single endpoint. The server validates each request against the schema and runs resolver functions per field. Introspection lets tools read the schema. It is an alternative to a REST API within an Application Programming Interface (API) strategy.
Data Engineering
GraphQL Foundation — GraphQL Specification (October 2021) — https://spec.graphql.org/October2021/; GraphQL.org — Learn GraphQL — https://graphql.org/learn/
