3 Exploring GraphQL APIs

 

Chapter 2 from GraphQL in Action by Samer Buna

This chapter covers

  • Using GraphQL’s in-browser IDE to test GraphQL requests
  • Exploring the fundamentals of sending GraphQL data requests
  • Exploring read and write example operations from the GitHub GraphQL API
  • Exploring GraphQL’s introspective features

The easiest way to start learning about the powerful features of the GraphQL language is to use its feature-rich interactive in-browser IDE. This IDE uses GraphQL’s type system to provide features you can use to explore what you can do with GraphQL and to write and test your GraphQL requests without leaving your browser. Using this IDE, we will continue to explore examples of GraphQL queries and mutations. We’ll look at the fundamental parts of a GraphQL request and test examples from the official GitHub GraphQL API.

2.1  The GraphiQL editor

When thinking about the requests your client applications need to make to servers, you can benefit from a graphical tool to help you first come up with these requests and then test them before committing to them in application code. Such a tool can also help you improve these requests, validate your improvements, and debug any requests that are running into problems. In the GraphQL world, this tool is called GraphiQL (with an i before the QL and pronounced “graphical”). GraphiQL is an open source web application written entirely with React.js and GraphQL, and it can be run in a browser.

2.2  The basics of the GraphQL language

2.2.1  Requests

2.2.2  Fields

2.3  Examples from the GitHub API

2.3.1  Reading data from GitHub

2.3.2  Updating data at GitHub

2.3.3  Introspective queries

2.4  Summary