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.
Request parameters
Location | Name | Required | Description/Example |
---|---|---|---|
URL |
host [string] |
Yes |
computer.network.net |
URL |
ServerName [string] |
Yes |
myrepsrv1 |
URL |
TaskName [string] |
Yes |
|
URL |
option [enum run_options] |
This is required for Replicate tasks, but is not relevant for Compose tasks. |
RELOAD_TARGET |
URL |
Timeout [int32] |
Optional (default is 60 seconds) |
60 (seconds) |
Header |
EnterpriseManager.APISessionID [string] |
Yes |
wCo0_KvjEUFROvfHF5KGrw |
Header |
Yes if the run option = RESUME_PROCESSING_FROM_TIMESTAMP or RECOVER_USING_CHECKPOINT_STORED_ON_TARGET |
"Content-Type: application/json"
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. For more information, see Body below. |
|
Header |
This is the number of bytes in the content body. 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 option = RESUME_PROCESSING_FROM_TIMESTAMP or RECOVER_USING_CHECKPOINT_STORED_ON_TARGET |
"Content-Length: 37"
For example commands, see Resume processing from timestamp cURL examples for Replicate tasks. |
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 below. |
Request body format
If the task option 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.
If the task option 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
Name | Description |
---|---|
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\run.json" --header "Content-Length: 37" https://
computer.network.net/attunityenterprisemanager/api/
v1/servers/rep2008r2gs7.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/rep2008r2gs7.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 2017 16:57:27 GMT
Payload
{"state":"RUNNING","error_message":""}
{"error_code":"INVALID_SESSION_ID","error_message":"Session expired or invalid"}
Error response
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 or RECOVER_USING_CHECKPOINT_STORED_ON_TARGET. |
When the option Tables are already loaded. Start processing changes from Timestamp is selected in the Advanced Run Options dialog box for a task, the option sent to the API must be RESUME_PROCESSING_FROM_TIMESTAMP. |
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 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). |