# GraphQL Mutate Task

This is a task that calls the GraphQL mutate API provided by the server. When writing the MutationQuery, variable processing can be done in two ways, and it is recommended to use Method 2.

Method 1: You can use the data and variables from the scenario context, as well as [script internal variables](../concept/script-internal-variables.md). This method is suitable for applying string variables.

```graphql
mutation {
  syncAllMarketplaceOrder(fromDate: "${this.variables.fromDate}", toDate: "${this.variables.toDate}") {
    ...
  }

  removeTagFromObject(tag: "${this.data.tag}") {
    ...
  }
}
```

Method 2: Specify the variables to be used in `variables`, and use GraphQL variable processing. The value of `variables` can be specified as an accessor for the data in the scenario context. This method is suitable for applying object-type variables.

```graphql
mutation($fromDate: String!, $toDate: String!) {
  syncAllMarketplaceOrder(fromDate: $fromDate, toDate: $toDate) {
    ...
  }

  removeTagFromObject(tag: $tag) {
    ...
  }
}
```

## Parameters

- `mutation`

  - Input the GraphQL mutation query.

- `variables`
  - Define the variables to be used in the GraphQL query.
  - Specify the variable names as keys, and set the data accessor corresponding to the variable value as the value.
