Add Backup Server

Virtualizor supports three types backup viz LOCAL, SSH and FTP. In case of LOCAL backups the VPS image is backed up on the directory of the node server itself. For remote backups you need to add the details of the remote backup servers which can be done using the Add Backup Server API. The API response will contain “done” as “true” after successful addition of the backup server.

After adding the backup server you need to make sure that it is added in the backup plan for the VPS files to be backed up. Also use the Test Backup Connectivity API to test the connection to the backup server after it has been added.

For more information, please refer this Backup Server guide.

HTTP Request

https://hostname:4085/index.php?act=addbackupservers

Parameters

NameMethodValueDescriptionRequired
actGETaddbackupserversThe action specified to perform operation and return “done” as “true” after the backup server has been addedYes
hostnamePOSTtextAny one of the Hostname of the Backup Server or IP address can be addedYes
namePOSTtextUnique name for the Backup ServerYes
typePOSTtextType of the Server (FTP / SSH)Yes
usernamePOSTtextUsername for the backupserverYes
passwordPOSTtextPassword of the backupserverYes
portPOSTIntPort numberYes

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['hostname'] = 'testhost';
    $post['name'] = 'backupstest';
    $post['type'] = 'SSH';
    $post['username'] = 'test';
    $post['password'] = 'test123';
    $post['port'] = 22;

    $output = $admin->addbackupserver($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "Add Backup Server",
    "done": true,
    "timenow": 1535547543,
    "time_taken": "0.223"
}
Was this helpful to you?