0
0
GraphQLquery~10 mins

Query arguments 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 query that takes an argument called 'id'.

GraphQL
query getUser($[1]: ID!) { user(id: $[1]) { name } }
Drag options to blanks, or click blank then click option'
Aid
BuserId
Cname
Dinput
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different argument name than the variable used in the query.
Forgetting to specify the argument type.
2fill in blank
medium

Complete the code to pass the argument value when calling the query.

GraphQL
query getUser($id: ID!) { user(id: [1]) { email } }
Drag options to blanks, or click blank then click option'
AuserId
Bid
C$id
Dinput
Attempts:
3 left
💡 Hint
Common Mistakes
Using the argument name without '$' inside the query.
Passing a different variable name than declared.
3fill in blank
hard

Fix the error in the query argument declaration.

GraphQL
query getPost($postId: [1]) { post(id: $postId) { title } }
Drag options to blanks, or click blank then click option'
ABoolean
BString
CInt
DID!
Attempts:
3 left
💡 Hint
Common Mistakes
Using a nullable type when the argument is required.
Using the wrong type for an ID argument.
4fill in blank
hard

Fill both blanks to define a query with two arguments: 'limit' and 'offset'.

GraphQL
query getItems($limit: [1], $offset: [2]) { items(limit: $limit, offset: $offset) { id name } }
Drag options to blanks, or click blank then click option'
AInt!
BString
CInt
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Making both arguments required or both optional incorrectly.
Using wrong types like String or Boolean for numeric arguments.
5fill in blank
hard

Fill all three blanks to define a query with arguments 'search', 'limit', and 'offset' with correct types.

GraphQL
query searchItems($search: [1], $limit: [2], $offset: [3]) { items(search: $search, limit: $limit, offset: $offset) { id description } }
Drag options to blanks, or click blank then click option'
AString!
BInt!
CInt
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to mark required arguments with '!'.
Using Boolean type for non-boolean arguments.