What is GraphQL?
What is GraphQL?
What is GraphQL?
GraphQL is a query language for APIs. Instead of multiple REST endpoints, a GraphQL API exposes a single endpoint where the client sends a query describing exactly the fields it wants, and the server returns precisely that data - no more, no less.
GraphQL vs. REST
- REST may require several round-trips to gather related data; GraphQL fetches it in one request.
- REST returns a fixed shape; GraphQL lets the client shape the response.
- REST maps verbs to URLs; GraphQL uses types and fields in a schema.
When to Use GraphQL
GraphQL shines for complex, nested data needs and mobile clients where minimizing data transfer matters. It is less common for simple public APIs, where REST’s predictability often wins.