Working with GraphQL
Bloodbath proposes a powerful GraphQL API.
It's the same API we use internally for developing our applications, most notably our own dashboard. We follow a Relay style of schema.
If you're new to GraphQL, Apollo has resources for beginners. The official documentation is another good starting point.
Prerequisite
Acquire your API keyEndpoint
Bloodbath's GraphQL endpoint is:
https://api.bloodbath.io/graphql
It supports introspection so you can query the whole schema.
Authorization
To start querying the endpoint, you must add the API key to your authorization
headers.
{
"headers": {
"authorization": "Bearer <Your API key>"
}
}
Check your access
Once you have the headers in place you can ping the GraphQL API
query ping {
ping {
receivedAt
}
}
It should respond with something like
{
"data": {
"ping": {
"receivedAt": "2021-05-23T20:45:44.409594Z"
}
}
}
Examples
List events
query listEvents {
listEvents(first: 5) {
pageInfo {
startCursor
}
edges {
node {
id
eventId
method
lockedAt
}
}
}
}
Find an event
query findEvent{
findEvent(
id: "f6596250-044b-4070-a256-31f0977ea4f3"
) {
eventId
scheduledFor
}
}
Last updated
Was this helpful?