GraphQL API
Last updated
Was this helpful?
Last updated
Was this helpful?
Equipped with an , you may now use it to make requests to our GraphQL API.
If you've never used GraphQL before, below you will find everything you need to make requests. If you're already familiar with GraphQL or are ready to start making GraphQL requests, you can head over to our to find example queries and test them using the .
We chose to deliver our API with GraphQL because, compared to traditional REST endpoints, GraphQL allows you to specify exactly the data you want returned, and it enables fetching complex data structures in one request instead of many smaller requests. GraphQL also supports real-time updates via GraphQL subscriptions with websockets out of the box.
No. Our GraphQL API can be called in the same way you make REST API calls, by just sending a request to an HTTP endpoint.
Compared to typical REST APIs, all requests to GraphQL are POST requests to the following endpoint:
In the headers of your request, you must include:
Replace ${accessToken}
with your .
Next, the body
of your request should be a JSON-encoded object containing your GraphQL query and any applicable variables in the following format.
When you receive a response back to your request, the response will take the following form:
Note: Unlike most REST APIs, GraphQL will always return a 200 OK HTTP status code, even if your query failed. You can instead determine if an error occurred by checking whether data
in the response is null
.
The following example demonstrates how you would get a list of tables in a specific workspace using the Pitchly GraphQL API in Node.js.
A successful response for this request may look something like this:
If the request had failed due to an invalid access token, for example, data
would have looked something like this (and you still would have received a 200 OK HTTP status code):
to view our full GraphQL schema documentation and all query options.
to access the GraphQL Explorer, a web interface where you can test GraphQL requests against our API straight from your browser!
to consult the full list of pitchly field types and sample return values for each type.