Search code examples
githubgraphqlgithub-graphql

When should you not use GitHub GraphQL API?


Much has been written about the benefits of the GitHub GraphQL API. And this is a really great technology. The only thing I can't figure out is in what situations is it still better to use the good old REST API v3?


Solution

  • Github GraphQL API is subject to the following caveats:

    • GraphQL API can only be accessed using authentication. You need a token to use this API. Thus, you can't use GraphQL in an environment where you can't secure the provisioning of this token. For example, in a web app without github authentication. This is a big caveat, especially for people who want to create web app or scripts that target only public repository informations.
    • Searching commits and code using the search API is not possible in Github Graphql. Only searching repos, issues and users are supported (for the search API)
    • some features like comparing commits and getting contributors are not possible yet in Graphql. Another example: you can't recursively get a tree using GraphQL API
    • some mutations already available in v3 may not yet have been implemented in GraphQL (create commit, create tag, create branch etc...), checkout mutations documentation