Skip to main content

Using GraphQL Clients

You can run queries on real GitHub data using various GraphQL clients and libraries.

Using GraphQL client IDEs

There are many open-source GraphQL client IDEs you can use to access GitHub's GraphQL API.

See Formation d’appels avec GraphQL for extensive information on HTTP methods, authentication, and GraphQL call structure.

First, choose a client. Common options include GraphiQL, Insomnia, and Altair (desktop/web/extension). You can see the full list of clients in the GraphQL organization's tool directory.

The following generic instructions will work with most GraphQL clients:

  1. Point the client at the GraphQL endpoint: https://api.github.com/graphql.

  2. Add an Authorization header: Authorization: Bearer TOKEN (replace TOKEN with your GitHub personal access token. For more information, see Gestion de vos jetons d'accès personnels).

  3. Set the request method to POST or if it's available, use the client-provided GraphQL mode.

  4. Enter your query or mutation in the editor and, if needed, provide variables in the "Variables" panel.

    Example:

    query {
      viewer {
        login
      }
    }
    
  5. If your client needs a schema for documentation rendering or autocomplete, fetch it via a GraphQL introspection query. Many clients can do this automatically from the "Docs" panel.

    Minimal introspection query:

    query IntrospectionQuery {
      __schema {
        types {
          name
        }
      }
    }
    
  6. Run the request and inspect the JSON response. Query from example should return the login associated with the GitHub personal access token you authenticated with.

Use the client UI to explore docs, run queries, and save requests as needed.

GitHub CLI

You can also use the command line with GitHub CLI to run GraphQL queries.

  1. Install and authenticate with GitHub CLI.
  2. Run a query against https://api.github.com/graphql using the GraphQL endpoint with the gh api subcommand.

Example:

gh api graphql -f query='query { viewer { login } }'

This should return the login associated with the GitHub personal access token you authenticated with.

Requesting support

Pour consulter les questions, les rapports de bogues et les discussions concernant GitHub Apps, OAuth apps et le développement d’API, explorez les Catégorie API et Webhooks dans les discussions de la communauté GitHub. Les discussions sont animées et gérées par le personnel GitHub et répondues par la communauté GitHub.

Envisagez de contacter le Support GitHub directement à l’aide du formulaire de contact pour :

  • Réponse garantie du personnel de GitHub
  • Les demandes de support impliquant des données sensibles ou des préoccupations d’ordre privé
  • Demandes de fonctionnalités
  • Commentaires sur les produits GitHub