Tasks

This page describes the APIs that can be used to retrieve and run Tasks and Actions.

Create a Task API

Purpose:

Allows creating a task (performing an Action) for a Configuration.

Recommended list of tasks:

backupAndSend - Create Backup Log & Send to Standby

applyBackup - Apply Backup Log onto Standby Database

failOver - Activate Standby

API:

POST /api/tasks

Request body:

{ "Task": { "ConfigurationId": 1, "Script": "backupAndSend", "Params": {} } }

Curl example:

curl -k -u admin:admin -d '{"Task":{"ConfigurationId":1,"Script":"backupAndSend","Params":{}}}' https://localhost:4433/api/tasks

Successful response body:

{ "Status": 200, "Result": { "TaskId": 1, "UserId": 1, "TaskData": { "ConfigurationId": 1, "Script": "backupAndSend", "Params": {} }, "State": "Start", "StateData": {}, "History": { "States": [ { "EnterTime": "2022-02-28T15:36:12Z", "State": "Start", "StateData": {}, "Logs": [], "ExecutionState": "", "ExecutionStateData": null } ] }, "Updated": "2022-02-28T15:36:12Z", "CliAgentRepoName": "", "CliExecutionId": 0, "TraceContext": null } }

Get Task progress API

Purpose:

Allows getting actual task progress (Started, In Progress, Success, Error) together with description message.

API:

GET /api/tasks/{taskId}

Request body:

None

Curl example:

curl -k -u admin:admin https://localhost:4433/api/tasks/1

Successful response body:

{ "Status": 200, "Result": { "TaskId": 1, "State": "In Progress", "Progress": [ { "Timestamp": "2022-02-28T15:36:12Z", "Message": "" }, { "Timestamp": "2022-02-28T15:36:12Z", "Message": "Starting to do the thing" } ] } }