GraphQL Concepts
The following pages describe some GraphQL concepts, like queries and mutations.
What is GraphQL?
GraphQL is a query language for APIs, which allows clients to ask for the data they need (and nothing more), in the format they want, across multiple resources, in a single request. All requests are served through a single endpoint, so the request body is responsible for expressing the actions for a server to execute on resources.
“At its simplest, GraphQL is about asking for specific fields on objects.” [https://graphql.org]
Some of its design principles are that it is:
- Customizable: GraphQL allows you to query as many fields from the API as you actually need. There’s no over-fetching or under-fetching.
- Strongly typed: A GraphQL server defines the application’s type system. This makes it easy for tools to validate that a given query is valid and can be executed.
- Introspective: Information about the schema is available by querying the schema. This provides a way to understand all of the fields and operations available and ensures that clients are always kept up-to-date with changes to the schema.
- Hierarchical: A GraphQL query is structured just like the data it returns. It naturally follows relationships between fields and helps to present this data in a user interface.
- Language-independent: GraphQL can be used with any backend framework or programming language implementation.