# RunTask

## General

### Replicate URL

https://{host}/attunityenterprisemanager/api/v1/servers/{ServerName}/tasks/{TaskName}?action=run&option={option}&timeout={timeout}

### Compose URL

https://{host}/attunityenterprisemanager/api/v1/servers/{ServerName}/tasks/{TaskName}?action=run&timeout={timeout}

### Description

Run the selected task according to the specified option.

### HTTP method

POST

### Required user role

See [Required Enterprise Manager permissions](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Introduction/AEMPermissions.htm).

## Request parameters

Request parameters

| Location | Name | Required | Description/Example |
| --- | --- | --- | --- |
| URL | host [string] | Yes | computer.network.net |
| URL | ServerName [string] | Yes | myrepsrv1 |
| URL | TaskName [string] | Yes | <ul> <li><span><span>Replicate</span>:</span> - The name of the task.</li> <li> <p><span><span>Compose</span>: </span>- The name of the task or workflow appended with a double underscore and the project name.</p> <p><span><span>Example: </span></span>&nbsp;</p> <p><span>mytask__myproject</span> </p> </li> </ul> |
| URL | [](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Task)[option](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Run) [enum run\_options] | For Replicate tasks, all options are supported.<br><br>For Compose tasks, specify option=RESUME\_PROCESSING to run the task. | RELOAD\_TARGET |
| URL | Timeout [int32] | Optional (default is 60 seconds) | 60 (seconds) |
| Header | EnterpriseManager.APISessionID [string] | Yes | wCo0\_KvjEUFROvfHF5KGrw |
| Header | [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_runTask.htm)Content-Type: [Type] | Yes if the run [](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Task)[option](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Run) = RESUME\_PROCESSING\_FROM\_TIMESTAMP, RESUME\_PROCESSING\_FROM\_POSITION, or RECOVER\_USING\_CHECKPOINT\_STORED\_ON\_TARGET | "Content-Type: application/json"<br><br>You can either specify the `Content-Type` payload inline or by referencing a JSON file. The payload format differs slightly according to whether it is specified inline or by referencing a JSON file.<br><br>For more information, see [Body](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_runTask.htm#Body) below. |
| Header | [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_runTask.htm)Content-Length:<br><br>This is the number of bytes in the content body.<br><br>Note that the number of bytes that you specify must be exactly the same as the number of bytes in the JSON file. This number can be ascertained by copy-pasting the text into a text editor such as **Notepad ++** (which shows the number of bytes as "Length" at the bottom of its console). | Yes if the [](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Task)[option](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Run) = RESUME\_PROCESSING\_FROM\_TIMESTAMP, RESUME\_PROCESSING\_FROM\_POSITION, or RECOVER\_USING\_CHECKPOINT\_STORED\_ON\_TARGET | "Content-Length: 37"<br><br>For example commands, see [Resume processing from timestamp cURL examples for Replicate tasks](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_runTask.htm#cURL Res). |
| [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_runTask.htm)Body | `cdcposition` | Yes | The `cdcposition` parameter can either be specified inline or in an external JSON file. The format for both is described in [Request body format](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_runTask.htm#Body2) below. |

## Request body format

### RESUME\_PROCESSING\_FROM\_TIMESTAMP

If the task [](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Task)[option](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Run) is RESUME\_PROCESSING\_FROM\_TIMESTAMP, then the format should be:

JSON File Format:

`{"cdcposition":"timestamp"}`

Example:

`{"cdcposition":"2017-03-07T11:19:03"}`

Inline Format:

`"{\"cdcposition\":\"timestamp\"}"`

Example:

`"{\"cdcposition\":\"2017-03-07T11:19:03\"}"`

For example commands, see [cURL Resume Processing from Timestamp Examples](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_runTask.htm#Resumeexample).

### RESUME\_PROCESSING\_FROM\_POSITION

f the task [](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Task)[option](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Run) is RESUME\_PROCESSING\_FROM\_POSITION then, assuming the source database is SQL Server, the format should be:

JSON File Format:

`{"cdcposition":"LSN"}`

Example:

`{"cdcposition":"15000000040000037"}`

Inline Format:

`"{\"cdcposition\":\"LSN\"}"`

Example:

`"{\"cdcposition\":\"15000000040000037\"}"`

For example commands, see [cURL Resume Processing from Timestamp Examples](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_runTask.htm#Resumeexample).

### RECOVER\_USING\_CHECKPOINT\_STORED\_ON\_TARGET

If the task [](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Task)[option](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Run) is RECOVER\_USING\_CHECKPOINT\_STORED\_ON\_TARGET, then the format should be:

JSON File Format:

`{"cdcposition":"target_checkpoint"}`

Example:

`{"cdcposition":"Checkpoint:V1#1#timestamp:2017-02-14T12:34:44#0#0#*#0#0"}`

Inline Format:

`"{\"cdcposition\":\"target_checkpoint\"}"`

Example:

`"{\"cdcposition\":\"Checkpoint:V1#1#timestamp:2017-02-14T12:34:44#0#0#*#0#0\"}"`

## Response body

`{
`

`"state":"{enum task_state}",
`

`"error_message":""
`

`}
`

## Response parameters

Response parameters

| Name | Description |
| --- | --- |
| [state](https://help.qlik.com/en-US/enterprise-manager/May2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#state) {enum task\_state] | The current state of the task. |
| error\_message | The description of the error. |

## Reload target cURL example for Replicate tasks

### cURL

`curl -i -k -X POST --header "EnterpriseManager.APISessionID: wCo0_KvjEUFROvfHF5KGrw" --header "Content-Length: 0" https://computer.network.net/attunityenterprisemanager/api/v1/servers/myrepsrv1/tasks/SalesDBBackup?action=run&option=RELOAD_TARGET`

### Response

`Headers:`

`HTTP/1.1 200 OK`

`Cache-Control: no-cache, no-store`

`Content-Length: 38`

`Content-Type: application/json; charset=utf-8`

`Server: Microsoft-HTTPAPI/2.0`

`Date: Mon, 26 Dec 2016 16:28:25 GMT`

### Payload

`{`

`"state":"RUNNING",`

`"error_message":""`

`}`

## Resume processing from timestamp cURL examples for Replicate tasks

### cURL - When the payload content is in a JSON file

`curl -i -k -X POST --header "EnterpriseManager.APISessionID: wCo0_KvjEUFROvfHF5KGrw" --header "Content-Type: application/json" -T @"C:\exports\resumefromtimestamp.json" --header "Content-Length: 37" https://computer.network.net/attunityenterprisemanager/api/v1/servers/rep2022r2gs7.qa.int/tasks/SalesDBBackup?action=run&option=RESUME_PROCESSING_FROM_TIMESTAMP"`

### cURL - When the payload content is inline

`curl -i -k -X POST --header "EnterpriseManager.APISessionID: wCo0_KvjEUFROvfHF5KGrw" --header "Content-Type: application/json" -d "{\"cdcposition\":\"2017-03-07T11:19:03\"}" "https://computer.network.net/attunityenterprisemanager/api/v1/servers/rep2022r2gs7.qa.int/tasks/SalesDBBackup?action=run&option=RESUME_PROCESSING_FROM_TIMESTAMP"`

### Response

`Headers:`

`HTTP/1.1 200 OK` `Cache-Control: no-cache, no-store` `Content-Length: 38` `Content-Type: application/json; charset=utf-8` `Server: Microsoft-HTTPAPI/2.0` `Date: Tue, 07 Mar 2022 16:57:27 GMT`

### Payload

`{"state":"RUNNING","error_message":""}` `{"error_code":"INVALID_SESSION_ID","error_message":"Session expired or invalid"}` ` `

## Resume processing from position cURL examples for Replicate tasks

### cURL - When the payload content is in a JSON file

`curl -i -k -X POST --header "EnterpriseManager.APISessionID: wCo0_KvjEUFROvfHF5KGrw" --header "Content-Type: application/json" -T @"C:\exports\resumefrompositon.json" --header "Content-Length: 37" https://computer.network.net/attunityenterprisemanager/api/v1/servers/rep2022r2gs7.qa.int/tasks/SalesDBBackup?action=run&option=RESUME_PROCESSING_FROM_POSITION"`

### cURL - When the payload content is inline

`curl -i -k -X POST --header "EnterpriseManager.APISessionID: wCo0_KvjEUFROvfHF5KGrw" --header "Content-Type: application/json" -d "{\"cdcposition\":\"15000000040000037\"}" "https://computer.network.net/attunityenterprisemanager/api/v1/servers/rep2022r2gs7.qa.int/tasks/SalesDBBackup?action=run&option=RESUME_PROCESSING_FROM_POSITION"`

### Response

`Headers:`

`HTTP/1.1 200 OK` `Cache-Control: no-cache, no-store` `Content-Length: 38` `Content-Type: application/json; charset=utf-8` `Server: Microsoft-HTTPAPI/2.0` `Date: Tue, 07 Mar 2022 16:57:27 GMT`

### Payload

`{"state":"RUNNING","error_message":""}` `{"error_code":"INVALID_SESSION_ID","error_message":"Session expired or invalid"}`

## Error response

Error responses

| HTTP Code | Enterprise Manager Code | Text | Description |
| --- | --- | --- | --- |
| 500 | AEM\_TASK\_ALREADY\_RUNNING | Replicate task {task} on server {server} is already running. | The task cannot be run because it is already running. |
| 500 | AEM\_TASK\_IN\_RECOVERY | Replicate task {task} on server {server} cannot be run as it is in a recovery state. | The task cannot be run because it is in Recovery state. |
| 500 | AEM\_WRONG\_OPTION\_FOR\_CDCPOSITION | Replicate task {task] on server {server} cannot be run with cdcposition {position} and option {option}. Change the option to RESUME\_PROCESSING\_FROM\_TIMESTAMP, RESUME\_PROCESSING\_FROM\_POSITION, or RECOVER\_USING\_CHECKPOINT\_STORED\_ON\_TARGET | This error is returned when the specified option conflicts with the setting in the Advanced Run Options dialog in Replicate. |
| 500 | AEM\_CDC\_POSITION\_ERR\_FORMAT | The cdcposition parameter value for Replicate task {task} on server {server} is not in the correct format ('YYYY-MM-DDThh:mm:ssZ'). | The cdcPosition parameter must follow this format: YYYY-MM-DDThh:mm:ssZ<br><br>Parameters: task name and server name. |
| 500 | AEM\_RUN\_TASK\_TIMEOUT | Replicate task {task} on server {server} timed out when requested to “Run”. | The task does not assume a Running state or any other steady state (error o stopped). |
| 500 | AEM\_RUN\_TASK\_INNER\_ERR | Replicate task {task} on server {server} encountered an error when requested to run. | Replicate experienced an error/exception when trying to run the task. |
| 500 | AEM\_RUN\_TASK\_NO\_SRC\_NO\_TRG | Replicate task {task} on server {server} has no source or target endpoints. | Task validation revealed that the task is missing a source and a target. |
| 500 | AEM\_RUN\_TASK\_NO\_SRC | Replicate task {task} on server {server} has no source endpoint. | Task validation revealed that the task is missing a source. |
| 500 | AEM\_RUN\_TASK\_TRG | Replicate task {task} on server {server} has no target endpoint. | Task validation revealed that the task is missing a target. |
| 500 | AEM\_RUN\_TASK\_NOT\_FL\_NOR\_CDC | Replicate task {task} on server {server} cannot be run without at least one of the replication options enabled (Full Load, Apply Changes, or Store Changes). | Task validation of a unidirectional task revealed that the replication option definition for the task is missing (Full Load, Apply Changes, or Store Changes). |
| 500 | AEM\_RUN\_BIDI\_TASK\_NO\_FL\_NOR\_CDC | Replicate task {task} on server {server} cannot be run without at least one of the replication options enabled (Full Load or Apply Changes). | Task validation of a unidirectional task revealed that the replication option definition for the task is missing (Full Load, Apply Changes, or Store Changes). |