Bloodbath API
  • Bloodbath API
  • Getting started
    • Acquire your API key
    • Schedule your first event
    • Being on the beta release
  • API
    • Working with REST
    • Working with GraphQL
  • Open source libraries
  • Ruby
  • Python
  • Node
  • FAQ
    • What protocols can be used?
    • What's the maximum payload size?
    • What's the correct format to build headers?
    • Wrong format when sending my body over the REST API
Powered by GitBook
On this page
  • Prerequisite
  • Endpoint
  • Authorization
  • Check your access
  • Examples
  • List events
  • Find an event

Was this helpful?

  1. API

Working with GraphQL

Bloodbath proposes a powerful GraphQL API.

PreviousWorking with RESTNextWhat protocols can be used?

Last updated 3 years ago

Was this helpful?

It's the same API we use internally for developing our applications, most notably our own dashboard. We follow a of schema.

If you're new to GraphQL, Apollo has . is another good starting point.

Prerequisite

Endpoint

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
      }
    }
  }
}

You'll notice that a difference between id and eventId; we have a Relay style schema. It means we have to map a node id and the event id has to be put on the side.

Find an event

query findEvent{
  findEvent(
    id: "f6596250-044b-4070-a256-31f0977ea4f3"
  ) {
    eventId
    scheduledFor
  }
}

Relay style
resources for beginners
The official documentation
Acquire your API key