This video describes how to add multiple fields to your GraphQL queries. The API specifies the fields, and the response will be the same shape as the query.
- [Narrator] Let's explore some of the other fields…that are part of the view object.…You may have noticed when typing in to the…GraphiQL interface here that you're seeing…some auto complete behavior happening.…As I type the first letter or two of a new field,…we're going to see lots of different options…start to populate.…Now that's really cool, but we can do even better than this.…If you're wondering what fields are available…not just by letter, but all of them.…What you can do is hit control and space…and that's going to populate an entire list for you.…
Awesome.…So I'm going to pick a couple of these out…I'm going to choose bio,…I'm going to choose id,…I'll hit control and space again,…and we'll pick company,…and then finally we're going…to choose this first one avatarURL, cool.…So when I hit play again it's going to…return all of this data to us.…Now keep in mind when I make this query…this is returning the live data to me.…If I was to go to get hub dot com…and change my bio or something like this…it's going to return whatever the value…
In this course, learn how to get started with GraphQL. Eve Porcello walks through the basics of this query language, diving into the data fetching specification, and helping you get up to speed with the syntax and vocabulary of GraphQL. Eve explains how to create basic queries, including how to work with arguments and multiple fields. She also goes into complex techniques for handling data, including working with aliases, fragments, and pagination. Plus, she covers how to edit and transform data with mutations.
- Learning about the origins of GraphQL
- Learning about how GraphQL makes data fetching and updating easier
- Creating basic queries
- Using multiple fields
- Understanding schemas
- Handling data
- Drilling down into nested fields with a query
- Adding variables for argument values
- Creating mutations
- Adding a reaction mutation