Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to request the user name in a GraphQL query.
GraphQL
query { user { [1] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a field that does not represent the user's name.
✗ Incorrect
The field name correctly requests the user's name in the query.
2fill in blank
mediumComplete the code to add a variable for user ID in the query.
GraphQL
query getUser($id: ID!) { user(id: [1]) { name } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name without the dollar sign.
✗ Incorrect
The variable $id is used to pass the user ID in the query.
3fill in blank
hardFix the error in the query to correctly request posts with their titles.
GraphQL
query { posts { [1] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural or incorrect field names.
✗ Incorrect
The correct field to request post titles is title.
4fill in blank
hardFill both blanks to request posts with title and author name.
GraphQL
query { posts { [1] author { [2] } } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Requesting wrong fields like
id or email instead.✗ Incorrect
The post's title and the author's name fields are requested.
5fill in blank
hardFill all three blanks to request comments with text, author name, and creation date.
GraphQL
query { comments { [1] author { [2] } [3] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect field names or missing one of the required fields.
✗ Incorrect
The comment's text, the author's name, and the comment's createdAt date are requested.