⬡ GraphQL Beginner

What is a GraphQL endpoint?

Answer

A GraphQL endpoint is a single URL that handles all API operations — unlike REST which has a different URL per resource. Conventionally, it is served at /graphql (e.g., https://api.example.com/graphql). All queries, mutations, and subscriptions go to this one endpoint. HTTP method: POST for queries and mutations (body contains the operation), GET is supported for queries (query string parameter). Request body format: { "query": "{ users { id name } }", "variables": {}, "operationName": "GetUsers" }. Response is always JSON: { "data": {...}, "errors": [...] }. Subscriptions typically use a WebSocket connection to the same or a separate endpoint. The single endpoint simplifies API versioning but requires more careful authorization and rate limiting.