Search⌘ K
AI Features

The Structure of a Query

Explore the detailed structure of GraphQL queries, including the use of operation types and named queries. Learn to access nested objects and apply directives like include and skip for conditional querying using GitHub's GraphQL API.

The Query Statement

Now, let’s take a step back to examine the structure of the GraphQL query. After we were introduced to variables, we encountered the query statement in our query structure for the first time. Before using the query statement, we used the shorthand version of a query in which we omitted the statement. However, as we are using variables, the query statement must be included. Try the following query without variables but with the query statement to verify that the longer version of a query works.

C++
query {
organization(login: "the-road-to-learn-react") {
name
url
}
}

While it’s not the shorthand version of the query, it still ...