Eve demonstrates how to work with required arguments and multiple arguments in a GraphQL query. Plus, see how errors are thrown if all required arguments aren't provided.
- [Narrator] Let's try to query another field…the repository field.…I'm going to do this by creating another query…I'll hit control and space to give us our list.…Repository is five down in this drop down.…Let's pass a name argument to this repository…so we're going to look for the GraphQL repository.…Now something that I haven't mentioned yet…is that I'm using double quotes for all of our strings here.…If I try to use single quotes you're going to see this…red error message looking stuff here.…
So, double quotes are a requirement.…You have to use them, single quotes aren't going to work.…So unlike some programming languages…where you can get away with either GraphQL is not like that.…Excellent, so let's look for the…id on the repository field for now…and I'm going to go ahead and click play.…And we see our first error message over here on the right.…And it says, field repository is missing…required arguments, owner.…So this is really descriptive about which…argument must be provided.…
So, I can make an educated guess here…
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