Use the Import KVM API to get Import supported utilities.
HTTP Request
https://hostname:4085/index.php?act=import&sa=kvm&changeserid=SERID
Parameters
Name | Method | Type | Description | Required |
---|---|---|---|---|
act | GET | text | The action specified to retrieve data after vps is powered off | Yes |
sa | GET | text | The import wizard name of which to use import functionality. | Yes |
changeserid | GET | int | The serid of server of which vps wants to be imported/list | Yes |
importvps | POST | int | Provide if you want to import VPS | No |
vsbw_VPSNAME | POST | int | Bandwidth value, Provide if you want to import VPS | No |
vsuser_VPSNAME | POST | int | User ID, Provide if you want to import VPS | No |
By default this API will return list of VPS to be imported.
NOTE: In parameter vsbw_VPSNAME and vsuser_VPSNAME VPSNAME is the actual vps name.
For example if there are there 3 VPS to import having vps names as 5, 8 and 25 respectively then the parameters will be vsbw_5, vsbw_8 and vsbw_25 Same for vsuser will be vsuser_5, vsuser_8 and vsuser_25
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['changeserid'] = 3;
$post['importvps'] = 1; //Provide if you want to import
$post['vsbw_v1032'] = 2; //Provide if you want to import
$post['vsuser_v1032'] = 15; //Provide if you want to import
$post['vsbw_v1025'] = 2; //Provide if you want to import
$post['vsuser_v1025'] = 15; //Provide if you want to import
$output = $admin->import_kvm($post);
print_r(json_encode($output));
?>
Output
{
"title":"Import",
"done":1,
"orphan":{
"v1032":v1032,
"v1025":v1025
},
"users":{
"15":{
"uid":"15",
"password":"$1$Z7W.Zjxs$G0o8EhqSSDfgspWkSkMYG0",
"email":"a@b.c",
"type":"0",
"aclid":"0",
"pid":"0",
"uplid":"0",
"inhouse_billing":"0",
"cur_bal":"0.00",
"cur_usage":"0.00",
"cur_invoices":"0.00",
"max_cost":"0",
"num_vs":"0",
"num_users":"0",
"space":"0",
"ram":"0",
"burst":"0",
"bandwidth":"0",
"cpu":"0",
"cores":"0",
"cpu_percent":"0",
"num_cores":"0",
"num_ipv4":"0",
"num_ip_int":"0",
"num_ipv6":"0",
"num_ipv6_subnet":"0",
"allowed_virts":"",
"network_speed":"0",
"upload_speed":"0",
"openvz":"0",
"xen":"0",
"xenhvm":"0",
"kvm":"0",
"sg":null,
"mg":null,
"preferences":"a:2:{s:5:\"fname\";s:1:\"a\";s:5:\"lname\";s:1:\"b\";}",
"dnsplid":"0",
"act_status":"1",
"activation_code":"",
"date_created":"0",
"service_period":"0",
"band_suspend":"0",
"billing_warn":null,
"suspended":null,
"foreign_uid":"0",
"webuzo_prem_apps":"0"
},
"9":{
"uid":"9",
"password":"$1$KWXrM5aD$l7OWtjrtfFcQ9sm\/mOr1i\/",
"email":"abhijeet@softaculous.com",
"type":"0",
"aclid":"0",
"pid":"0",
"uplid":"0",
"inhouse_billing":"0",
"cur_bal":"0.00",
"cur_usage":"0.00",
"cur_invoices":"0.00",
"max_cost":"0",
"num_vs":"0",
"num_users":"0",
"space":"0",
"ram":"0",
"burst":"0",
"bandwidth":"0",
"cpu":"0",
"cores":"0",
"cpu_percent":"0",
"num_cores":"0",
"num_ipv4":"0",
"num_ip_int":"0",
"num_ipv6":"0",
"num_ipv6_subnet":"0",
"allowed_virts":"",
"network_speed":"0",
"upload_speed":"0",
"openvz":"0",
"xen":"0",
"xenhvm":"0",
"kvm":"0",
"sg":null,
"mg":null,
"preferences":"a:2:{s:5:\"fname\";s:4:\"Abhi\";s:5:\"lname\";s:1:\"M\";}",
"dnsplid":"0",
"act_status":"1",
"activation_code":"",
"date_created":"0",
"service_period":"0",
"band_suspend":"0",
"billing_warn":null,
"suspended":null,
"foreign_uid":"0",
"webuzo_prem_apps":"0"
}
},
"timenow":1606978292,
"time_taken":"0.092"
}