Appearance
Mutate Driver
This query allows users to decide what field of a DRIVER object they want to change. However, you can change only one field at a time.
Query Structure:
updateDriver(
driverid: ID!
key: String!
value: String!
): Driver
Argument(s):
This query must be made with the following arguments:
Driver Id
driverid : ID - the unique identifier of a driver (compulsory)
Key
id : String - the field name of a driver object (compulsory)
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 DRIVER as described in the section above.
Response:
A driver with new (updated) details. The response type is an Object
Example:
- Changing the last name of a driver
FORMER DATA:
{
"data": {
"driver": {
"firstName": "Max",
"lastName": "Munstermann",
"id": "8908019a-0eeb-eefa-d0ca-f4c94074c70a"
}
}
}
In this example, the last name of a driver will be changed from "Munstermann" to "Falke". Therefore, the "key" of the mutation will be "lastName" and the "value" will be "Falke".
WRITING THE MUTATION:
mutation {
updateDriver(
driverid: "8908019a-0eeb-eefa-d0ca-f4c94074c70a"
key: "lastName"
value: "Falke"
) {
firstName
lastName
id
}
}
RESPONSE (with new data)
{
"data": {
"updateDriver": {
"firstName": "Max",
"lastName": "Falke",
"id": "8908019a-0eeb-eefa-d0ca-f4c94074c70a"
}
}
}
apomap partnerAPI