Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page describes the APIs that can be used to retrieve and update StandbyMP Configurations information as well as to perform StandbyMP Tasks and Actions.

Table of Contents

Security

All requests are made over HTTPS.

Authentication API

Purpose:

Returns existing authentication cookie in a header.

API:

POST /api/login

Request body:

Code Block
{
  "UserName": "USERNAME",
  "Password": "PASSWORD"
}

Successful response body:

Code Block
{
  "Status": 200,
  "Result": {}
}

Successful response header example:

Code Block
Set-Cookie: dbvisit-standby=MTY0Njg2NTYwOHxEdi1CQkFFQ180SUFBUkFCRUFBQUxmLUNBQUVHYzNSeWFXNW5EQVVBQTNOcFpBWnpkSEpwYm1jTUVnQVFaVEV5TnpnMVkyTTJOREV4TlRJeE53PT18W39Sxb15sXZWvlEQ-mEFcwfusDjPXuFY-CXsaDu6CAU=; Path=/; Expires=Fri, 08 Apr 2022 22:40:08 GMT; Max-Age=2592000

A successful response header contains a cookie that must be supplied along with future API calls.

Alternatively, each request can contain an Authorization header using HTTP BASIC authentication specifying the user name and password.

Curl example of calling Configuration(s) API with HTTP BASIC authentication :

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

where username is “admin“ and password is “admin“

Configurations

Configuration(s) Listing API

Purpose:

Returns existing Configuration(s) and related settings, such as Automated Standby Update, Standby Update Delay, Email and Slack settings, Observer, etc.

API:

GET /api/configurations

to get information about all the Configurations

GET /api/configurations/{configurationId}

to get information about the specific one

Request body:

None.

Curl example:

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

Successful response body:

Expand
Code Block
languagejson
{
    "Status": 200,
    "Result": {
        "ConfigurationId": 1,
        "ConfigurationType": "PostgreSQL",
        "ConfigurationName": "PG1",
        "PrimaryAgentManagerId": "2w3l87blxgy2k",
        "PrimaryAgent": {
            "AgentManagerConfig": {
                "NatsAddress": "controlcenter",
                "NatsPort": 5533,
                "HostAddress": "postgresql1",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.27.0.3"
                ],
                "ServiceUser": "postgres",
                "AgentManagerId": "2w3l87blxgy2k",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890,
                "EnableDebugServer": true
            },
            "UserScript": "",
            "SpecificData": {
                "Port": 5432,
                "BinaryDirectory": "/usr/lib/postgresql/9.6/bin"
            }
        },
        "StandbyAgentManagerId": "2ig8qsjfi1c3r",
        "StandbyAgent": {
            "AgentManagerConfig": {
                "NatsAddress": "controlcenter",
                "NatsPort": 5533,
                "HostAddress": "postgresql2",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.27.0.4"
                ],
                "ServiceUser": "postgres",
                "AgentManagerId": "2ig8qsjfi1c3r",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890,
                "EnableDebugServer": true
            },
            "UserScript": "",
            "SpecificData": {
                "Port": 5432,
                "BinaryDirectory": "/usr/lib/postgresql/9.6/bin"
            }
        },
        "Settings": {
            "ApplicationDelayMinutes": 0,
            "StandbyModeConfig": {
                "UndoFilePath": "",
                "Enabled": false
            },
            "AutoSyncConfig": {
                "Enabled": false,
                "IntervalSeconds": 0,
                "BackupType": ""
            },
            "NotifierConfig": {
                "To": null
            },
            "ObserverConfigurationSettings": {
                "Enabled": false,
                "NotificationOnly": false,
                "CheckIntervalSeconds": 0,
                "MaxFailCount": 0,
                "SendEmail": false,
                "SendSlack": false,
                "HeartbeatEnabled": false,
                "HeartbeatHour": 0,
                "HeartbeatMinute": 0,
                "Rule": ""
            }
        },
        "HasFailedOver": false,
        "Disabled": false,
        "LicenseKey": "4jo70-qwp4l-7gplh-g1eji-yln5f-1gbil-1wzwk"
    }
}

Edit Configuration API

Purpose:

Allows updating Configuration parameters and settings, such as Automated Standby Update, Standby Update Delay, Email and Slack settings, Observer, etc.

Warning: This API allows to change all the Configuration parameters. Please be careful while using.

Parameters in the request body override only the corresponding parameters in Configuration.

API:

PUT /api/configurations/{configurationId}

to bulk update parameters,

PUT /api/configurations/{configurationId}/Settings/AutomatedStandbyUpdate/Enabled

to update 1 parameter

Request body:

Code Block
languagejson
{
    "Settings": {
        "AutomatedStandbyUpdate": {
            "Enabled": false
        }
    }
}

Curl example:

curl -k -u admin:admin -X PUT -d '{"Settings": {"AutomatedStandbyUpdate": {"Enabled": false}}}' https://localhost:4433/api/configurations/1

OR

curl -k -u admin:admin -X PUT -d 'false' https://localhost:4433/api/configurations/1/Settings/AutomatedStandbyUpdate/Enabled

Successful response body:

Code Block
languagejson
{
  "Status": 200,
  "Result": {}
}

Dashboard

Configuration(s) full information with current states API

Purpose:

Allows getting up-to-date information about Configuration(s), including the Configurations states (Busy, in Failover State, etc.) and Databases states (ONLINE, RECOVERING, etc), log gap, and others.

API:

POST /api/dashboard

to get information about all Configurations

POST /api/dashboard/{configurationId}

to get information about the specific one

Request body:

None.

Curl example:

curl -k -u admin:admin -d '{}' https://localhost:4433/api/dashboard

Successful response body:

Expand
Code Block
languagejson
{
    "Status": 200,
    "Result": [
        {
            "ConfigurationId": 1,
            "ConfigurationType": "Oracle",
            "ConfigurationName": "DEV",
            "PrimaryHost": {
                "HostAddress": "oracle1",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.22.0.4"
                ],
                "ServiceUser": "oracle",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890
            },
            "StandbyHost": {
                "HostAddress": "oracle2",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.22.0.8"
                ],
                "ServiceUser": "oracle",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890
            },
            "Settings": {
                "ApplicationDelayMinutes": 0,
                "StandbyMode": {
                    "UndoFilePath": "",
                    "Enabled": false
                },
                "AutomatedStandbyUpdate": {
                    "Enabled": true,
                    "IntervalSeconds": 600,
                    "BackupType": "l"
                },
                "Notifications": {
                    "To": null
                },
                "Observer": {
                    "Enabled": true,
                    "NotificationOnly": true,
                    "CheckIntervalSeconds": 60,
                    "MaxFailCount": 3,
                    "SendEmail": false,
                    "SendSlack": false,
                    "HeartbeatEnabled": false,
                    "HeartbeatHour": 7,
                    "HeartbeatMinute": 0,
                    "Rule": ""
                }
            },
            "HasFailedOver": false,
            "LicenseInfo": {
                "LicenseKey": "4jo6z-8aaai-u09b6-ijjwh-2a276-1phe9-k1quu",
                "ExpiryDate": "2020-07-10"
            },
            "PrimaryDatabaseState": "ONLINE",
            "StandbyDatabaseState": "RECOVERING",
            "ConfigurationBusy": false,
            "GapTimeSeconds": 17984,
            "GapTime": "4 hours 59 minutes 44 seconds"
        },
        {
            "ConfigurationId": 3,
            "ConfigurationType": "SqlServer",
            "ConfigurationName": "SQLTestBigDB",
            "PrimaryHost": {
                "HostAddress": "sql1",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.22.0.6"
                ],
                "ServiceUser": "sqlsrv",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890
            },
            "PrimaryInstanceName": "MSSQLSERVER",
            "StandbyHost": {
                "HostAddress": "sql2",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.22.0.9"
                ],
                "ServiceUser": "sqlsrv",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890
            },
            "StandbyInstanceName": "MSSQLSERVER",
            "Settings": {
                "ApplicationDelayMinutes": 0,
                "StandbyMode": {
                    "UndoFilePath": "",
                    "Enabled": false
                },
                "AutomatedStandbyUpdate": {
                    "Enabled": true,
                    "IntervalSeconds": 300,
                    "BackupType": "l"
                },
                "Notifications": {
                    "To": null
                },
                "Observer": {
                    "Enabled": true,
                    "NotificationOnly": true,
                    "CheckIntervalSeconds": 60,
                    "MaxFailCount": 3,
                    "SendEmail": false,
                    "SendSlack": false,
                    "HeartbeatEnabled": false,
                    "HeartbeatHour": 7,
                    "HeartbeatMinute": 0,
                    "Rule": ""
                }
            },
            "HasFailedOver": false,
            "LicenseInfo": {
                "LicenseKey": "4jo70-qwp4l-7gplh-g1ejv-z7t8p-20tah-iodzn",
                "ExpiryDate": "2022-03-11"
            },
            "PrimaryDatabaseState": "ONLINE",
            "StandbyDatabaseState": "RESTORING",
            "ConfigurationBusy": false,
            "GapTimeSeconds": 304,
            "GapTime": "5 minutes 4 seconds"
        },
        {
            "ConfigurationId": 2,
            "ConfigurationType": "SqlServer",
            "ConfigurationName": "SQLTestDB",
            "PrimaryHost": {
                "HostAddress": "sql1",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.22.0.6"
                ],
                "ServiceUser": "sqlsrv",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890
            },
            "PrimaryInstanceName": "MSSQLSERVER",
            "StandbyHost": {
                "HostAddress": "sql2",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.22.0.9"
                ],
                "ServiceUser": "sqlsrv",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890
            },
            "StandbyInstanceName": "MSSQLSERVER",
            "Settings": {
                "ApplicationDelayMinutes": 0,
                "StandbyMode": {
                    "UndoFilePath": "",
                    "Enabled": false
                },
                "AutomatedStandbyUpdate": {
                    "Enabled": true,
                    "IntervalSeconds": 300,
                    "BackupType": "l"
                },
                "Notifications": {
                    "To": null
                },
                "Observer": {
                    "Enabled": true,
                    "NotificationOnly": true,
                    "CheckIntervalSeconds": 60,
                    "MaxFailCount": 3,
                    "SendEmail": false,
                    "SendSlack": false,
                    "HeartbeatEnabled": false,
                    "HeartbeatHour": 7,
                    "HeartbeatMinute": 0,
                    "Rule": ""
                }
            },
            "HasFailedOver": false,
            "LicenseInfo": {
                "LicenseKey": "4jo70-qwp4l-7gplh-g1ejv-z7t8p-20tah-iodzn",
                "ExpiryDate": "2022-03-11"
            },
            "PrimaryDatabaseState": "ONLINE",
            "StandbyDatabaseState": "RESTORING",
            "ConfigurationBusy": false,
            "GapTimeSeconds": 304,
            "GapTime": "5 minutes 4 seconds"
        }
    ]
}

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

Other Tasks can be launched using this API as well.

API:

POST /api/tasks

Request body:

Code Block
languagejson
{
    "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:

Expand
Code Block
languagejson
{
    "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:

Code Block
languagejson
{
    "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"
            }
        ]
    }
}