Skip to main content

GraphQL API

To view the production GraphQL API click here.

Local Setup

To test the GraphQL API locally follow these steps:

  • Follow the setup and launch steps described in Leadership - Quick Start.
  • Open the GraphQL API endpoint at http://localhost:3000/api/graphql
  • Click Query your server to open Apollo Studio. Note: Make sure to a compliant browser like Chrome.

GraphQL API

tip

Apollo Studio is the most convenient web-based tool for working with the Leadership GraphQL API. However, it is also possible to use Postman or other tools to interact with the API. For more information see Postman - GraphQL Support.

  • Sign into the leadership site & navigate to http://localhost:3000/settings and generate a new Access Token.

Settings Page

caution

An Access Token generated locally (at http://localhost:3000/settings) will only work when testing the local GraphQL endpoint. An Access Token created in the production instance will only work on the production GraphQL endpoint.

  • Copy the token (it should start with eyJ) and add it as a header in Apollo Studio as follows Authorization: Bearer <API KEY>.

Authorization Header

  • The schema and queries for the GraphQL API should now be visible.

Apollo Schema

  • Start using the api! Here's a sample query to get you started.
query ExampleQuery {
getOfficers {
id
name
}
}