Using the API

On this page, you will find information on how to call and interact with the GraphQL API.

What is GraphQL?

GraphQL is a modern API protocol that enables you to select exactly what data you want. The GraphQL API is based on a connected graph of all the data available, allowing you to fetch all the data you need in a single request, while limiting the amount of data transmitted by sending only the requested data.Requests to the GraphQL API are made using HTTP requests to the API URL with the required access keys depending on the context and a query detailing the data you wish to retrieve.

Authentication

The API uses the same bot access tokens 
BOT
 and personal access tokens 
PAT
 as all other Challengermode APIs.
Refer to the Auth API to get started retrieving access tokens.

Exploring the GraphQL API

The Challengermode Client API schema is available as a GraphQL Schema Definition Language (SDL) file in the API reference. You can click here to download it.To get an overview of the graph or to perform test requests, we recommend using some of these tools in combination with the schema: 
GraphQL API reference
Challengermode's GraphQL API reference offers a built-in overview of all available queries, subscriptions, and mutations, including all the data models and types within the graph.
Banana Cake Pop
Banana Cake Pop is great for viewing the schema and to craft sample requests to test the API. It also supports autocomplete to aid you in writing queries.
GraphQL Voyager
GraphQL Voyager is a useful visualization tool to help you get a better overview of the graph and its relations.

Sample GraphQL query

query SearchTournamentsForGame($gameSlug: String!) {
            tournamentsForGame(input:
                {
                    gameSlug: $gameSlug,
                    tournamentFilter: {
                        openTournamentSelector: { }
                    }
                }
            )
            {
                state
                id
                name
                attendance
                {
                    roster {
                        lineups {
                            name
                        }
                    }
                }
        }
    } 

Further reading on GraphQL

Check out graphql.org and this introduction blog article at apollographql.com to learn more about GraphQL.