Complete the code to define a query that takes an argument called 'id'.
query getUser($[1]: ID!) { user(id: $[1]) { name } }
The argument name must match the variable used in the query. Here, 'id' is the correct argument name.
Complete the code to pass the argument value when calling the query.
query getUser($id: ID!) { user(id: [1]) { email } }When using variables in GraphQL queries, you must prefix them with '$' inside the query.
Fix the error in the query argument declaration.
query getPost($postId: [1]) { post(id: $postId) { title } }The 'ID!' type means the argument is required and must be an ID type, which is correct for identifying posts.
Fill both blanks to define a query with two arguments: 'limit' and 'offset'.
query getItems($limit: [1], $offset: [2]) { items(limit: $limit, offset: $offset) { id name } }
'limit' is required so it uses 'Int!'. 'offset' is optional so it uses 'Int'.
Fill all three blanks to define a query with arguments 'search', 'limit', and 'offset' with correct types.
query searchItems($search: [1], $limit: [2], $offset: [3]) { items(search: $search, limit: $limit, offset: $offset) { id description } }
'search' is a required string, so 'String!'. 'limit' is a required integer, so 'Int!'. 'offset' is optional integer, so 'Int'.