Virtualizor Clone VPS API allows you to seamlessly clone VPS from one server to another server OR same server without any manual intervention. The cloning process transfers all your VPS data including configuration and user data. During cloning, an exact copy of the VPS will be made on different storage disk of the server.
The API response will contain "actid" which can be used to monitor the migration process at admin panel or using the Task API.
It is recommended that you save the VPS data before starting this process as Virtualizor will power off the VPS to do the transfer.
For more information, you can refer this Clone VPS Guide.
HTTP Request
https://hostname:4085/index.php?act=clone
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | clone | The action specified to carry out operation and return data after vps has been cloned | Yes |
vpsid | POST | array | Array of the vps IDs to be cloned | Yes |
from_server | POST | from_server | The server ID from which the vps needs to be cloned | Yes |
storage | POST | array | Array of storage ID to be passed for cloning multidisk vps | Yes |
to_server | POST | Int | The server ID to which the vps will be cloned | Yes |
speed_limit | POST | Int | Setting a speed limit for vps cloning | No |
ignore_if_vdfconflict | POST | 1/0 | If checked will ignore domain forwarding conflicts | No |
disable_gzip | POST | 1/0 | If checked, compression (i.e. gzip) will not be used during migration | No |
preserve_ip | POST | 1/0 | Set this option to use same IP Address(s) on the migrated VPS | 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['from_server'] = '0';
$post['vpsid'] = array('180');
$post['storage'] = array('1', '5');
$post['to_server'] = '0';
$post['speed_limit'] = '40';
$output = $admin->clonevps($post);
print_r(json_encode($output));
?>
Output
{
"title": "Virtualizor",
"actid": "403",
"timenow": 1535367552,
"time_taken": "4.162"
}