Skip to content
On this page

Mutate Tour

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


Query Structure:

updateTour(
    tourid: ID!
    key: String!
    value: String!
): Tour

Argument(s):

This query must be made with the following arguments:

  1. Tour Id

    tourid : ID - the unique identifier of a tour (compulsory)

  2. Key

    id : String - the field name of a tour 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 TOUR as described in the section above.



Response:

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



Example:
  • Changing the vehicle type of a tour
FORMER DATA:
{
  "data": {
    "tour": {
      "vehicle": "car",
      "status": "finished",
      "distance": 3854.4610000000002,
      "id": "14bb75b5-97bf-4143-8a21-ad512565aecb"
    }
  }
}

In this example, the vehicle of a tour will be changed from "car" to "bike". Therefore, the "key" of the mutation will be "vehicle" and the "value" will be "bike".

WRITING THE MUTATION:

mutation {
  updateTour(
    tourid: "14bb75b5-97bf-4143-8a21-ad512565aecb"
    key: "vehicle"
    value: "bike"
  ) {
    vehicle
    status
    distance
    id
  }
}

RESPONSE (with new data)
{
  "data": {
    "updateTour": {
      "vehicle": "bike",
      "status": "finished",
      "distance": 3854.4610000000002,
      "id": "14bb75b5-97bf-4143-8a21-ad512565aecb"
    }
  }
}