GraphQL and GraphQL API Sitecore
A GraphQL query is a string that is sent to a server to be interpreted and fulfilled, which then returns JSON back to the client. GraphQL access Sitecore items using GraphQL API.
GraphQL is a syntax that describes how to ask for data, and is generally used to load data from a server to a client. GraphQL has three main characteristics:
- It lets the client specify exactly what data it needs.
- It makes it easier to aggregate data from multiple sources.
- It uses a type system to describe data.
With GraphQL, the user is able to make a single call to fetch the required information rather than to construct several REST requests to fetch the same.
Please find more details about GraphQL and GraphQL API.
GraphQL
It is a query language for your API. Think of it in SQL terms as “the world’s best SELECT
statement."
- Frontend-driven. The GraphQL protocol is oriented around the needs of frontends — whether a web app, PWA, or mobile app.
- Efficient. GraphQL returns only the requested data from a query, eliminating data over-fetching, saving bandwidth, and improving performance. Advanced features like query batching and automatic persisted queries reduce bandwidth needs even further.
- Strongly-typed and schema-driven. Built-in schema introspection drives amazing GUI query authoring tools, self-documentation, static analysis, and API mocking capabilities.
- A graph. GraphQL queries are graph traversal, which enables incredibly expressive queries that would take many requests if done with a REST API.
- An amazing ecosystem. The GraphQL community is large and vibrant, with a whole galaxy of useful tools already made.
GraphQL API
The Sitecore GraphQL API is an implementation of a GraphQL server on top of Sitecore. It is designed to be a generic GraphQL service platform — meaning it’s designed to host your API and present it via GraphQL queries.