GraphQL for Developers
GraphQL queries are handled via standard HTTP.
All GraphQL queries are POST requests
The first thing to understand is that the GraphQL query itself is sent along in the body of the request. Since HTTP GET calls cannot include a request body, every call sent to the GraphQL server must be a POST request.
The request body is JSON-encoded
The request body itself should be JSON encoded. So the query you write will be transformed into something like this:
{
"query": "query getCustomers {customers {customerID customerName}}"
}Use libraries
Unless you are programming in a very obscure language, there are probably client libraries that can abstract away a lot of this for you.
These clients typically let you write your query in standard GraphQL syntax, and they handle the rest.
Also, thanks to GraphQL's built-in introspection, many libraries can generate a fully-typed API client for you to use!
Last updated