Complete the code to define the GraphQL query body with the correct key.
{
"[1]": "{ user(id: \"1\") { name } }"
}The GraphQL request body must have a query key containing the query string.
Complete the code to include variables in the GraphQL body correctly.
{
"query": "query getUser($id: ID!) { user(id: $id) { name } }",
"[1]": { "id": "1" }
}The variables key holds the values for variables used in the query.
Fix the error in the GraphQL body by selecting the correct key for the operation name.
{
"query": "query getUser { user { name } }",
"[1]": "getUser"
}The operationName key specifies which named operation to execute when multiple are present.
Fill both blanks to create a valid GraphQL mutation body with variables.
{
"[1]": "mutation addUser($name: String!) { addUser(name: $name) { id } }",
"[2]": { "name": "Alice" }
}The first key must be mutation for mutation operations, and variables go under variables.
Fill all three blanks to build a complete GraphQL request body with query, variables, and operation name.
{
"[1]": "query getUser($id: ID!) { user(id: $id) { name } }",
"[2]": { "id": "2" },
"[3]": "getUser"
}The GraphQL body includes the query string, variables object, and operationName string for named operations.