Note
We will be removing this API call by the end of the year.
We encourage to use Manage VPS API call, you can easily manage the VPS using the below API call.
https://www.virtualizor.com/docs/admin-api/api-manage-vps/
Overview
Use the Edit VPS API to edit the configuration of the VPS present on the server. You can completely fine tune all the settings of the VPS like the hostname, root password, storage space, RAM, IP addresses and assigned bandwidth. The API response will contain "done" as "1" after successful update of the VPS.
Please make sure you pass all the required values listed below. If you are unsure of any values, you can search for the VPS details by passing the VPS ID to the List Virtual Server API.
HTTP Request
https://hostname:4085/index.php?act=editvs&vpsid=VPSID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | editvs | The action specified to retrieve data after vps has been edited | Yes |
vpsid | POST | Int | The ID of the vps that needs to be edited | Yes |
uid | POST | Int | The user ID to which the vps belongs | Yes |
hostname | POST | text | The hostname of the vps | Yes |
rootpass | POST | text | The password of the vps | Yes |
plid | POST | Int | If using plans to configure the vps, then plid has to be specified | No |
ips | POST | array | The array of ips to be assigned and used by the vps | No |
ipv6 | POST | array | The array of ipv6 address to be assigned and used by the vps | No |
space | POST | array | The disk space of the vps | No |
bus_driver | POST | text | Provide bus driver for proxmox QEMU/KVM | Required for Proxmox KVM |
bus_driver_num | POST | Int | Provide bus driver numbers ranging from 0-5 | Required for Proxmox KVM |
ram | POST | Int | The RAM value to be assigned to the vps | No |
swapram | POST | Int | The swap space assigned to the vps to be used as virtual RAM | No |
bandwidth | POST | Int | The bandwidth to be assigned to the vps | No |
network_speed | POST | Int | The network speed to be used by the vps | No |
cpu | POST | Int | The CPU weight for the VPS | No |
cores | POST | Int | The number of CPU Cores the vps will use | No |
cpu_percent | POST | Int | Set the CPU Percent, the vps could use out of the server CPU | No |
vnc | POST | 1/0 | If set, VNC access will be enabled | No |
vncpass | POST | text | This will change the vnc password | No |
acpi | POST | 1/0 | If set, then acpi will be enabled for the vps | No |
apic | POST | 1/0 | If set, then apic will be enabled for the vps | No |
pae | POST | 1/0 | If set, then pae will be enabled for the vps | No |
boot | POST | text | The boot order (dca or cda) (Only for KVM and Xen HVM) | No |
ips_int | POST | array | Set the internal ip for the vps | No |
cpupin | POST | array | Pin the particular CPU Cores to this VPS (Only for KVM, Virtuozzo KVM,Virtuozzo OpenVz, XEN) | No |
upload_speed | POST | Int | This will set the upload speed of the vps in KB/s | No |
virt | POST | text | Type of virtualization using which vps was created | No |
band_suspend | POST | 1/0 | If set then the vps will be suspended once it exceeds the bandwidth limit assigned | No |
hvm | POST | 1/0 | Pass value if it is hypervisor.Cannot be used while editing the vps. | No |
virtio | POST | 1/0 | Flag to enable VIRTIO (Only for KVM) | No |
cpu_mode | POST | text | Refer Values from below table | No |
topology_sockets | POST | Int | Specify the number of CPU Sockets to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP) | No |
topology_cores | POST | Int | Specify the number of CPU cores to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP) | No |
topology_threads | POST | Int | Specify the number of CPU Threads to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP) | No |
kvm_cache | POST | text | The type disk-cache mechanism can be writeback, writethrough, directsync or default (Only for KVM and Proxmox KVM) | No |
io_mode | POST | text | Sets the I/O policy for the VPS can be native/threads (Only for KVM) | No |
kvm_vga | POST | 1/0 | Enables VGA for the VPS (Only for KVM) | No |
acceleration | POST | 1/0 | If VGA is enabled then this option will enable 2D and 3D acceleration will be for the VPS | No |
disable_ebtables | POST | 1/0 | Disable ebtables for the VPS | No |
rdp | POST | 1/0 | IF set, then RDP will be enabled for windows vps | No |
vnc_keymap | POST | text | Allows to select keymap can be 'en-us', 'de-ch', 'ar', 'da', 'et', 'fo', 'fr-be', 'fr-ch', 'hu', 'it', 'lt', 'mk', 'nl', 'no', 'pt', 'ru', 'sv', 'tr', 'de', 'en-gb', 'es', 'fi', 'fr', 'fr-ca', 'hr', 'is', 'ja', 'lv', 'nl-be', 'pl', 'pt-br', 'sl', 'th' | No |
nic_type | POST | text | The NIC type (default or e1000) (Only for KVM and Xen) | No |
dns | POST | array | Adding DNS Nameservers to the vps | No |
osreinstall_limit | POST | Int | If you want to limit the number of OS re-installs per month.Eg. 0 - is unlimited | No |
admin_managed | POST | 1/0 | If checked, VPS can not be managed from Enduser panel | No |
disable_nw_config | POST | 1/0 | This will disable network config of the vps | No |
mgs | POST | array | The media group assigned to the vps | No |
burst | POST | Int | Set the burst RAM for the vps(Only for Open Vz and Proxmox) | No |
shadow | POST | Int | Amount of Shadow Memory for the vps | No |
iso | POST | text | The name of the iso file which will be used to install vps (Only for KVM, Proxmox KVM, Virtuozzo KVM, xcp and Xen) | No |
sec_iso | POST | text | The name of the secondary iso file which will be used to install vps (Only for KVM, Proxmox KVM, Virtuozzo KVM, xcp and Xen) | No |
pv_on_hvm | POST | 1/0 | If set then it will be enabled for the vps | No |
tuntap | POST | Int | Flag to enable tuntap (0 or 1) (Only for OpenVZ/OpenVZ7) | No |
ppp | POST | Int | Flag to enable ppp (0 or 1) (Only for OpenVZ/OpenVZ7) | No |
fuse | POST | Int | Flag to enable fuse (0 or 1) (Only for OpenVZ/OpenVZ7) | No |
ipip | POST | Int | Flag to enable ipip (0 or 1) (Only for OpenVZ/OpenVZ7) | No |
ipgre | POST | Int | Flag to enable ipgre (0 or 1) (Only for OpenVZ/OpenVZ7) | No |
nfs | POST | Int | Flag to enable nfs (0 or 1) (Only for OpenVZ/OpenVZ7) | No |
quotaugidlimit | POST | Int | Provide quotaugidlimit (Only for OpenVZ/OpenVZ7) | No |
iolimit | POST | Int | Provide iolimit (Only for OpenVZ/OpenVZ7) | No |
iopslimit | POST | Int | Provide iopslimit (Only for OpenVZ/OpenVZ7) | No |
vif_type | POST | text | The VIF type (netfront or ioemu) (Only for KVM and Xen HVM) | No |
bpid | POST | int | Provide Backup server id | No |
total_iops_sec | POST | Int | Provide total I/O per sec in MBs (For KVM only) | No |
read_bytes_sec | POST | Int | Provide read mega per sec in MBs (For KVM only) | No |
write_bytes_sec | POST | Int | Provide write mega per sec in MBs (For KVM only) | No |
os_type | POST | Text | Setting the proper os_type allows Proxmox VE to optimize some low level parameters, Please refer following table for valid os_type values (For Proxmox kvm only) | |
rtc | POST | 1/0 | If rtc is is set to1 then it is enabled else it is disabled (For Proxmox kvm only) | |
kvm_vga | POST | Int | Assign vga vram value in MB. By default virtualizor will assign 8MB. (For KVM only) | No |
bios | POST | string | seabios/uefi (For KVM only) | yes |
enable_tpm | POST | Int | pass 1 to enable (For KVM only) | No |
bootord | POST | string | Order in which disk is to boot give comma sperated values 'disk1,disk2' (For KVM only) | No |
Valid os_type values (For Proxmox kvm only)
Values | Description |
other | unspecified OS / Default |
wxp | Microsoft Windows XP |
w2k | Microsoft Windows 2000 |
w2k3 | Microsoft Windows 2003 |
w2k8 | Microsoft Windows 2008 |
wvista | Microsoft Windows Vista |
win7 | Microsoft Windows 7 |
win8 | Microsoft Windows 8/2012/2012r2 |
win10 | Microsoft Windows 10/2016 |
l24 | Linux 2.4 Kernel |
l26 | Linux 2.6 - 5.X Kernel |
solaris | Solaris/OpenSolaris/OpenIndiania kernel |
CPU Mode values for KVM
( host-model | host-passthrough ) |
CPU Mode values for Proxmox KVM
( host-model | host-passthrough | 486 | athlon | pentium | pentium2 | pentium3 | coreduo | core2duo | kvm32 | qemu32 | qemu64 | phenom | Conroe | Penryn | Nehalem | SandyBridge | IvyBridge | Haswell | Broadwell | Opteron_G1 | Opteron_G2 | Opteron_G3 | Opteron_G4 | Opteron_G5 ) |
Bus Drivers For Proxmox KVM
( sata | ide | virtio | scsi )
Sample Code For providing disk space in Proxmox KVM
<?php
$post['space'] = array(0=>array(
'size' => 2,
'st_uuid'=>'ngavdbegidnbme2d',
'bus_driver' => 'virtio',
'bus_driver_num' => 0),
1=>array(
'size'=>2,
'st_uuid'=>'ngavdbegidnbme2d',
'bus_driver' => 'virtio',
'bus_driver_num' => 1));
?>
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['vpsid'] = 47;
$post['uid'] = 57;
$post['hostname'] = 'Test_vps';
$post['rootpass'] = 'Test!23';
$post['plid'] = '';
$post['ips'] = array('192.168.2.118');
$post['ips_int'] = array('10.10.1.10');
$post['ipv6'] = array('2001:41d0:0008:5372:0000:0000:4c11:bf9b');
$post['space'] = array(0=>array(
'size' => 3,
'st_uuid'=>'ngavdbegidnbme2d',
'disk_uuid' => 'dl0qxnekyfznbgdj'
),
1=>array(
'size'=> 2,
'st_uuid'=>'ngavdbegidnbme2d',
'disk_uuid' => 'dfwo9lrtnumudyie'
),
2=>array(
'size'=> 1,
'st_uuid'=>'ngavdbegidnbme2d'
)
);
$post['ram'] = 0;
$post['disable_ebtables'] = 1;
$post['bandwidth'] = 0;
$post['cores'] = 4;
$post['cpupin'] = 1024;
$post['network_speed'] = '' ;
$post['upload_speed'] = '';
$post['virt'] = 'kvm';
$post['hvm'] = '';
$post['io'] = '';
$post['burst'] = '';
$post['cpu_percent'] = 0;
$post['swap'] = 1024;
$post['acpi'] = 1;
$post['apic'] = 1;
$post['pae'] = 1;
$post['vnc'] = 1;
$post['shadow'] = '';
$post['iso'] = '';
$post['sec_iso'] = '';
$post['boot'] = '';
$post['band_suspend'] = '';
$post['pv_on_hvm'] = '';
$post['tuntap'] = '';
$post['mac_status'] = '';
$post['osreinstall_limit'] = '';
$post['mgs'] = '';
$post['webuzo'] = '';
$post['cpu_mode'] = 'default';
$post['admin_managed'] = '';
$post['rdp'] = '';
$post['disable_nw_config'] = '';
$post['topology_sockets'] = 0;
$post['topology_cores'] = 0;
$post['topology_threads'] = 0;
$post['vnc_keymap'] = 'en-us';
$post['cpupin'] = 2;
$post['dns'] = array('4.2.2.2','4.2.2.1');
$post['vncpass'] = 'hjdkls';
$post['bpid'] = 24; //Backup server id
$post['editvps'] = 1;
$output = $admin->editvs($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit Virtual Server",
"done": 1,
"error": [],
"vs_info": {
"vpsid": "47",
"vps_name": "v1005",
"uuid": "x3knml2m5tols5gy",
"serid": "0",
"time": "1534806643",
"edittime": "1534816836",
"virt": "kvm",
"uid": "57",
"plid": "0",
"hostname": "Test_vps",
"osid": "270",
"os_name": "centos-6.5-x86",
"iso": "",
"sec_iso": "",
"boot": "cda",
"space": "6",
"inodes": "0",
"ram": "128",
"burst": "0",
"swap": "0",
"cpu": "0",
"cores": "4",
"cpupin": "-1",
"cpu_percent": "0.00",
"bandwidth": "0",
"network_speed": "0",
"upload_speed": "-1",
"io": "0",
"ubc": "",
"acpi": "1",
"apic": "1",
"pae": "1",
"shadow": "0",
"vnc": "1",
"vncport": "5905",
"vnc_passwd": "",
"hvm": "0",
"suspended": "0",
"suspend_reason": null,
"nw_suspended": null,
"rescue": "0",
"band_suspend": "0",
"tuntap": "0",
"ppp": "0",
"ploop": "0",
"dns_nameserver": "a:2:{i:0;s:7:\"4.2.2.2\";i:1;s:7:\"4.2.2.1\";}",
"osreinstall_limit": "0",
"preferences": null,
"nic_type": "",
"vif_type": "",
"virtio": "0",
"pv_on_hvm": "0",
"disks": [
{
"did": "50",
"disk_uuid": "dl0qxnekyfznbgdj",
"st_uuid": "ngavdbegidnbme2d",
"vps_uuid": "x3knml2m5tols5gy",
"path": "/dev/vg/vsv1005-dl0qxnekyfznbgdj-x3knml2m5tols5gy",
"primary": "1",
"size": "3.000",
"size_unit": "",
"type": "block",
"format": "raw",
"num": "0",
"rescue": "0",
"extra": "",
"vpsid": "47"
},
{
"did": "51",
"disk_uuid": "dfwo9lrtnumudyie",
"st_uuid": "ngavdbegidnbme2d",
"vps_uuid": "x3knml2m5tols5gy",
"path": "/dev/vg/vsv1005-dfwo9lrtnumudyie-x3knml2m5tols5gy",
"primary": "0",
"size": "2.000",
"size_unit": "",
"type": "block",
"format": "raw",
"num": "1",
"rescue": "0",
"extra": "",
"vpsid": "47"
},
{
"did": "53",
"disk_uuid": "dmezrlpc1kiqxqrj",
"st_uuid": "ngavdbegidnbme2d",
"vps_uuid": "x3knml2m5tols5gy",
"path": "/dev/vg/vsv1005-dmezrlpc1kiqxqrj-x3knml2m5tols5gy",
"primary": "0",
"size": "1.000",
"size_unit": "",
"type": "block",
"format": "raw",
"num": "2",
"rescue": "0",
"extra": null,
"vpsid": "47"
}
],
"kvm_cache": "",
"io_mode": "",
"cpu_mode": "default",
"total_iops_sec": "0",
"read_bytes_sec": "0",
"write_bytes_sec": "0",
"kvm_vga": "0",
"acceleration": "0",
"vnc_keymap": "en-us",
"routing": "0",
"mg": "",
"used_bandwidth": "0.00",
"cached_disk": {
"disk": {
"Used": 776644,
"Available": 1189436,
"Use%": 39.5
},
"inode": {
"Inodes": 122880,
"IUsed": 21264,
"IFree": 101616,
"Use%": 17.3
}
},
"webuzo": "0",
"disable_ebtables": "1",
"install_xentools": "0",
"admin_managed": "0",
"rdp": "0",
"topology_sockets": "0",
"topology_cores": "0",
"topology_threads": "0",
"mac": "00:16:3e:bf:96:b9",
"notes": null,
"disable_nw_config": "0",
"locked": "",
"openvz_features": "",
"speed_cap": "",
"numa": "0",
"bpid": "24",
"bserid": "0",
"timezone": null,
"usbdevice": null,
"pid": "0",
"ips": [
"8.8.8.56"
],
"ips6": [
"2607:fa98:0030:0001:0000:0002:5fcf:e36e"
],
"ips6_subnet": [],
"ips_int": [
"10.0.0.12"
]
}
}