Making Requests
There are a few different ways to make requests into the GraphQL API:
- Using client libraries
- Sending JSON
- Sending raw GraphQL queries
Using client libraries
Client libraries will provide you with the fastest and most comprehensive way to access the API and can assist in handling auth, formatting your requests and your responses.
The Apollo client libraries are available for:
Additional clients are available for:
Sending JSON
You can send your GraphQL requests as JSON to our API and have it correctly interpolate variables passed into it. To do so, set the "Content-Type" header to "application/json" and format the query as such:
{
"query": "business(id: $business_name) {
name
id
rating
url
}",
"variables": {
"business_name": "garaje-san-francisco"
}
}
Sending raw GraphQL queries
If you want to send raw GraphQL queries to the API, you can still do so but you must set the "Content-Type" header to "application/graphql". If you do not, the request will be interpreted as JSON and will fail.
{
business(id: "garaje-san-francisco") {
name
id
rating
url
}
}
Updated almost 2 years ago