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.
You must be a Member to view code
Access all courses and lessons, track your progress, gain confidence and expertise.
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.