A mutation will allow you to update, create or remove an entity.
Update an entity
As an example, we will update a customer label. For that, you need to get its id, either with a GraphQL query, or directly from the stockpit app.
Now, we need to build our mutation, using the mutation name provided in the entities section of this guide. In this example, we only need to update the label and the email
mutation {
UpdateCustomer(id: $id, input: $input) {
label
last_name
}
}
With following variables:
{
"id": 100012,
"input": {
"label": "Bashirin",
"email": "[email protected]"
}
}
Variables are added in the section on the bottom of GraphiQL
Here is the result of the query:
{
"data": {
"UpdateCustomer": {
"label": "Bashirin",
"last_name": "Mraz"
}
}
}
So you set the data to update in the parameters, and the data of the result in the query.