0
0
GraphQLquery~10 mins

Data source integration in GraphQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a GraphQL query that fetches a list of users.

GraphQL
query GetUsers { users [1] { id name email } }
Drag options to blanks, or click blank then click option'
Alist
Bitems
Call
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'list' or 'items' which are not valid field names in this schema.
Leaving the blank empty causing syntax errors.
2fill in blank
medium

Complete the code to add an argument that filters users by their status.

GraphQL
query GetActiveUsers { users(status: [1]) { id name } }
Drag options to blanks, or click blank then click option'
AACTIVE
B"active"
C'active'
Dactive
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes causing syntax errors.
Using single quotes which are invalid in GraphQL argument syntax.
3fill in blank
hard

Fix the error in the mutation to add a new user by completing the missing input type.

GraphQL
mutation AddUser { addUser(input: [1]) { id name } }
Drag options to blanks, or click blank then click option'
ANewUserInput
BUserInput
CAddUserInput
DCreateUserInput
Attempts:
3 left
💡 Hint
Common Mistakes
Using input types that do not exist in the schema.
Confusing input type names causing errors.
4fill in blank
hard

Fill both blanks to write a query that fetches posts with their author's name and filters posts published after 2020.

GraphQL
query GetRecentPosts { posts(filter: { publishedYear: [1] }) { title author { [2] } } }
Drag options to blanks, or click blank then click option'
A2020
Bname
CauthorName
D2021
Attempts:
3 left
💡 Hint
Common Mistakes
Using 2020 which includes that year, not after.
Using 'authorName' which is not a valid field.
5fill in blank
hard

Fill all three blanks to write a mutation that updates a user's email by ID and returns the updated email and name.

GraphQL
mutation UpdateUserEmail { updateUser(id: [1], input: { email: [2] }) { [3] email } }
Drag options to blanks, or click blank then click option'
A"123"
B"newemail@example.com"
Cname
D123
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted strings for ID or email causing syntax errors.
Omitting the name field in the return selection.