Skip to content
On this page

Mutate Tour

This query allows users to decide what field of a TASK object they want to change. However, you can change only one field at a time.


Query Structure:

updateTask(
    taskid: ID!
    key: String!
    value: String!
): Task

Argument(s):

This query must be made with the following arguments:

  1. Task Id

    taskid : ID - the unique identifier of a task (compulsory)

  2. Key

    id : String - the field name of a task object (compulsory)

  3. Value

    id : String | Float | Int - the new value of a field (compulsory). It can either be a string, integer or float (compulsory)


The key of a mutation query must be in accordance with the Type Definitions and Schema of a TASK as described in the section above.



Response:

A task with new (updated) details. The response type is an Object



Example:
  • Changing the status of a task
FORMER DATA:
{
  "data": {
    "task": {
      "task_type": "delivery",
      "task_status": "unassigned",
      "task_id": "100ef5ea-19bf-e4b5-3609-4ee8ab999d11"
    }
  }
}

In this example, the status of a task will be changed from "unassigned" to "assigned". Therefore, the "key" of the mutation will be "task_status" and the "value" will be "assigned".

WRITING THE MUTATION:

mutation {
  updateTask(
    taskid: "100ef5ea-19bf-e4b5-3609-4ee8ab999d11"
    key: "task_status"
    value: "assigned"
  ) {
    task_type
    task_status
    task_id
  }
}

RESPONSE (with new data)
{
  "data": {
    "updateTask": {
      "task_type": "delivery",
      "task_status": "assigned",
      "task_id": "100ef5ea-19bf-e4b5-3609-4ee8ab999d11"
    }
  }
}