0
0
GraphQLquery~10 mins

Delete mutation pattern 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 delete mutation for removing a user by ID.

GraphQL
mutation DeleteUser($id: ID!) {
  deleteUser(id: [1]) {
    id
    name
  }
}
Drag options to blanks, or click blank then click option'
AuserId
Bid
CID
DdeleteId
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different variable name than declared in the mutation signature.
Confusing the type name 'ID' with the variable name.
2fill in blank
medium

Complete the code to specify the return fields after deleting a post.

GraphQL
mutation DeletePost($postId: ID!) {
  deletePost(id: $postId) {
    [1]
  }
}
Drag options to blanks, or click blank then click option'
Atitle content
Bid content
Cid title
DpostId title
Attempts:
3 left
💡 Hint
Common Mistakes
Returning fields that do not exist on the deleted object.
Using variable names instead of field names.
3fill in blank
hard

Fix the error in the delete mutation by completing the argument name correctly.

GraphQL
mutation RemoveComment($commentId: ID!) {
  deleteComment([1]: $commentId) {
    id
  }
}
Drag options to blanks, or click blank then click option'
AcommentId
Bid
CcommentID
Dcomment_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect casing in argument names.
Using underscores instead of camelCase.
4fill in blank
hard

Fill both blanks to complete the delete mutation and specify the return fields.

GraphQL
mutation DeleteProduct($[1]: ID!) {
  deleteProduct(id: $[2]) {
    id
    name
  }
}
Drag options to blanks, or click blank then click option'
AproductId
BproductID
Cid
DprodId
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names in declaration and usage.
Using uppercase letters inconsistently.
5fill in blank
hard

Fill all three blanks to write a delete mutation for removing an order and returning its ID and status.

GraphQL
mutation DeleteOrder($[1]: ID!) {
  deleteOrder([2]: $[3]) {
    id
    status
  }
}
Drag options to blanks, or click blank then click option'
AorderId
BorderID
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing orderID and orderId.
Using id instead of the expected argument name.