GraphQL is a data query and manipulation language for APIs that provides several advantages over REST APIs:
- GraphQL allows clients to define the structure of the data required, and exactly the fields they need from the server. This prevents over-fetching and under-fetching compared to REST.
- GraphQL queries use a typed schema so clients can know the types of data available without having to make a request. It also allows for nested queries to fetch multiple objects in one request.
- GraphQL uses HTTP POST requests with a JSON body to specify the query and variables. This provides security advantages over REST by allowing all requests to go to a single endpoint.
- GraphQL queries support variables which