ImportTask
General
URL
https://{Host}/attunityenterprisemanager/api/v1/servers/{ServerName}/tasks/{task}?action=import
Description
Import a single task's JSON definitions provided in the request body into the requested server repository on the selected server.
The ImportTask method enables importing all valid JSON definitions provided in the request body. This includes task settings, tables/table patterns (include/exclude), table settings and global transformations. Information about endpoints is included if it was included in the JSON file.
When you import a task, Items that existed in the target server before the import and have no new JSON definition in the request body are not modified and not removed. This means that ImportTask provides no way of removing old definitions that are no longer needed.
Supported only with Replicate 5.2 and later.
HTTP method
POST
Required user role
See Required Enterprise Manager permissions.
Request parameters
Location | Name | Required | Example |
---|---|---|---|
URL |
Host [string] |
Yes |
computer.network.net |
URL |
ServerName [string] |
Yes |
myrepsrv1 |
URL |
TaskName [string] |
Yes |
SalesDBBackup |
Header |
EnterpriseManager.APISessionID [string] |
Yes |
wCo0_KvjEUFROvfHF5KGrw |
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 |
"Content-Length: 3986" |
Body |
A JSON document to import [stream] |
Yes |
localServer1.json |
Response
JSON File
cURL example
cURL Example
curl -i -k -X POST --header "EnterpriseManager.APISessionID: wCo0_KvjEUFROvfHF5KGrw " --header "Content-Length: 3986" --header "Content-Type: application/json" " https://computer.network.net/attunityenterprisemanager/api/v1/servers/ myrepsrv1/tasks/SalesDBBackup?action=import" -T "C:\exports\ SalesDBBackup.json"
Response
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Length: 0
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Tue, 28 Feb 2017 17:45:41 GMT
Error response
HTTP Code | Enterprise Manager Code | Text | Description |
---|---|---|---|
500 |
AEM_IMPORT_TASK_NO_PERMISSION_ON_ENDPOINT |
Failed to import task {task} to replication server {server} as the logged in user does not have permission to add or modify endpoints. |
The task cannot be imported because it includes endpoint definitions, and the user does not have permissions to insert endpoints. |
500 |
AEM_IMPORT_TASK_CONTAIN_ALIEN_ITEMS |
Failed to import task {task} to replication server {server} as the JSON file contains unsupported objects. |
The task cannot be imported because the stream contains items that cannot be imported (such as remote machines). |
500 |
AEM_IMPORT_TASK_NAME_DIFFER |
Failed to import task {task} to replication server {server} as the JSON file contains conflicting tasks. |
The task cannot be imported because the stream contains conflicting tasks. |
500 |
AEM_IMPORT_TASK_CONTAINS_MULTIPLE_TASKS |
Failed to import task to replication server {server} as the JSON file contains multiple tasks. To import multiple tasks, use ImportAll instead. |
The task cannot be imported since the stream contains multiple tasks, and the method can only import a single task. |
500 |
AEM_TASK_NOT_IMPORTABLE |
Failed to import task {task} as the task is running on server {server}. Stop the task and then try again. |
Occurs when trying to import a running task. |
500 |
AEM_IMPORT_TASK_CONTENT_EMPTY |
Failed to import task {task} to replication server {server} as the JSON file is empty. |
The task cannot be imported as the specified JSON file is empty. |
500 |
AEM_IMPORT_TASK_ENDPOINT_DIFFER |
Failed to import task {task} to server {server} as the endpoint names in the JSON file’s “task” and “databases” sections are not the same. |
The task cannot be imported as the endpoint names in the specified JSON file's “task” and “databases” sections are different. |
500 |
AEM_IMPORT_TASK_NO_ENDPOINT_IN_SERVER |
Failed to import task {task} to replication server {server} as the {role} endpoint {endpoint} does not exist on the target server. |
The task cannot be imported as one of the endpoints specified in the exported JSON file does not exist on the target server. |
500 |
AEM_IMPORT_TASK_CANNOT_OVERRIDE_TASK |
Replicate (server '{0}') import unable to delete task. Error message '{2} |
The task cannot be imported since the task that it was supposed to override cannot be deleted. |