Query the GitHub GraphQL API

Eve Porcello
InstructorEve Porcello
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 3 years ago

One of the first major companies to launch a public GraphQL API was GitHub. In this lesson, we'll send queries to the GitHub API to view our own data, and we'll get acquainted with some of the core features of the GraphQL query language.

Instructor: [00:00] To start, you can go to developer.github.com/v4/explorer. Then you can click on "Sign in with GitHub" to log into the Explorer so that you can start sending queries. On the left side in the GraphiQL window, let's write a query for viewer. Viewer is whoever is logged in.

[00:19] We'll also request the fields for login, bio, and company. When you hit "play," you'll the response from the query on the right side as JSON. All of the fields in the response match the fields in the query.

[00:31] GraphQL APIs are self-documenting. If I click on "query," you'll see a list of all of the available queries. At the bottom is our viewer query. If I click on that, you'll see that this returns the type user.

[00:44] Then you can click on "user" to show all of the available fields on the user type. You can also surface the queryable fields within GraphiQL itself by hitting control-space anywhere in your query.

egghead
egghead
~ 9 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today