Use the Edit Backup Server API to edit the information about the backup server. These are remote servers on which backup of the VPS is uploaded. After updating the details of the backup server you need to make sure that these details are also updated in the backup plan also. Also use the Test Backup Connectivity API to test the connection to the backup server after it has been edited.
For more information, please refer this Backup Server guide.
HTTP Request
https://hostname:4085/index.php?act=editbackupserver&id=BID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | editbackupserver | The action will edit the backup server | Yes |
id | GET | Int | The backup server ID which needs to be edited | Yes |
name | POST | text | Unique name for the Backup Server | Yes |
hostname | POST | text | The hostname that has to given to the backup server | Yes |
type | POST | text | The type of server (SSH/FTP) | Yes |
username | POST | text | Username for the backupserver | Yes |
port | POST | Int | The port that will be used to connect to the server | Yes |
password | POST | text | Password of the backupserver | No |
ssh_key | POST | text | Pass 1 to enable ssh key authentication | No |
sshpub_key | POST | text | Provide the public key (compulsory if ssh_key is passed). | No |
sshpri_key | POST | text | Provide the Private key (compulsory if ssh_key is passed). | No |
ftps | POST | 1/0 | Pass 1 to enable support FTPs server(FTPs server should be confgured) Since 3.1.3 version | No |
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['id'] = 4;
$post['name'] = 'lxc server';
$post['hostname'] = 'lxc.nuftp.com';
$post['type'] = 'SSH';
$post['username'] = 'root';
$post['password'] = '';
$post['ssh_key'] = 1; //pass only if you want to use keys to authenticate
$post[
'sshpub_key'
] = 'YOUR PUBLIC KEY'; //pass only if ssh_key is set
$post[
'sshpri_key'
] = 'YOUR PRIVATE KEY';
//pass only if ssh_key is set
$post['port'] = 2044;
$output = $admin->editbackupserver($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit Backup Server",
"done": "true",
"timenow": "1477273778",
"time_taken": "0.078"
}