Skip to content
On this page

Mutate Location

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


Query Structure:

updateLocation(
    locationid: ID!
    key: String!
    value: String!
): Location

Argument(s):

This query must be made with the following arguments:

  1. Location Id

    locationid : ID - the unique identifier of a location (compulsory)

  2. Key

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



Response:

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



Example:
  • Changing the address of a location
FORMER DATA:
{
  "data": {
    "location": {
      "name": "Jad Apotheke",
      "address": "Hermannstraße 22, 33813 Oerlinghausen, Deutschland",
      "system": "cida_nova_plus",
      "type": "branch",
      "id": "0a839781-73a3-387e-25eb-54d82627042d"
    }
  }
}

In this example, the address of a location will be changed from "Hermannstraße 22, 33813 Oerlinghausen, Deutschland" to "Flutterstraße 23, 32791 Lage, Deutschland". Therefore, the "key" of the mutation will be "address" and the "value" will be "Flutterstraße 23, 32791 Lage, Deutschland".

WRITING THE MUTATION:

mutation {
  updateLocation(
    locationid: "0a839781-73a3-387e-25eb-54d82627042d"
    key: "address"
    value: "Flutterstraße 23, 32791 Lage, Deutschland"
  ) {
    name
    address
    system
    type
    id
  }
}

RESPONSE (with new data)
{
  "data": {
    "updateLocation": {
      "name": "Jad Apotheke",
      "address": "Flutterstraße 23, 32791 Lage, Deutschland",
      "system": "cida_nova_plus",
      "type": "branch",
      "id": "0a839781-73a3-387e-25eb-54d82627042d"
    }
  }
}