0
0
GraphQLquery~10 mins

Mutation syntax 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 start a GraphQL mutation operation.

GraphQL
mutation [1] { createUser(name: "Alice") { id } }
Drag options to blanks, or click blank then click option'
Aquery
BCreateUser
Cmutation
Dsubscription
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'query' instead of a mutation operation name.
Omitting the operation name entirely.
2fill in blank
medium

Complete the code to specify the mutation field to update a user's email.

GraphQL
mutation UpdateEmail { [1](id: "123", email: "new@example.com") { id email } }
Drag options to blanks, or click blank then click option'
AupdateUserEmail
BgetUser
CdeleteUser
DcreateUser
Attempts:
3 left
💡 Hint
Common Mistakes
Using a query field like 'getUser' in a mutation.
Using 'deleteUser' or 'createUser' instead of updating.
3fill in blank
hard

Fix the error in the mutation by completing the missing keyword.

GraphQL
mutation CreateUser { createUser(name: "Bob") [1] id name }
Drag options to blanks, or click blank then click option'
Aselect
Breturn
C{
Dfields
Attempts:
3 left
💡 Hint
Common Mistakes
Using keywords like 'return' or 'select' which are not part of GraphQL syntax.
Omitting the curly braces around the fields.
4fill in blank
hard

Complete the code to complete the mutation that deletes a user and returns their id and name.

GraphQL
mutation DeleteUser [1](id: "456") { id name }
Drag options to blanks, or click blank then click option'
AdeleteUser
BcreateUser
C{
D}
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'createUser' instead of 'deleteUser'.
Omitting the opening curly brace for the selection set.
5fill in blank
hard

Fill both blanks to complete the mutation that creates a user and returns their id and email.

GraphQL
mutation {BLANK_1}} { {{BLANK_2}}(name: "Eve", email: "eve@example.com") { id email }
Drag options to blanks, or click blank then click option'
ACreateUser
BcreateUser
C{
DupdateUser
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'updateUser' instead of 'createUser' for creating a user.
Omitting the opening curly brace for the selection set.