Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introduction to GraphQL!
You have completed Introduction to GraphQL!
Preview
In this video, we will go over the different parts that make up a GraphQL query, before diving into each one in more detail in the videos that follow.
New Terms:
- Declaration - The keyword which starts every GraphQL query
- Endpoint - A section of a GraphQL backend responsible for returning a specific piece of all the data available
Further Reading:
Tutorial: Getting started with GraphQL queries and mutations, by Tim Lucas
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
So you've gotten your
first taste of GraphQL.
0:05
Now we're going to dive in and understand
the different parts that make up a query.
0:07
In this video, we'll briefly go over each
part before explaining them in more detail
0:12
in the videos that follow.
0:17
At its most basic,
a query is composed of three parts,
0:19
the query declaration,
the endpoint, and the fields.
0:23
The query declaration tells GraphQL that
we'll only be retrieving information and
0:27
not making any changes.
0:32
In the curly braces following
the query declaration,
0:35
we specify which endpoint or
endpoints we'd like to call.
0:38
In this case, we're calling
the topMoviebyRevenue endpoint,
0:43
which will return the top earning
movie we have in our backend.
0:47
In the curly braces
following the endpoint name,
0:51
we specify the fields we want returned for
that endpoint.
0:54
This is how we tell GraphQL to include or
0:58
exclude certain properties
from our response.
1:01
So that's the basic anatomy of a query.
1:05
In the next video,
1:07
you'll learn how to tell GraphQL which
fields you want included in your response.
1:09
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up