Edit VPS

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

NameMethodValueDescriptionRequired
actGETeditvsThe action specified to retrieve data after vps has been editedYes
vpsidPOSTIntThe ID of the vps that needs to be editedYes
uidPOSTIntThe user ID to which the vps belongsYes
hostnamePOSTtextThe hostname of the vpsYes
rootpassPOSTtextThe password of the vpsYes
plidPOSTIntIf using plans to configure the vps, then plid has to be specifiedNo
ipsPOSTarrayThe array of ips to be assigned and used by the vpsNo
ipv6POSTarrayThe array of ipv6 address to be assigned and used by the vpsNo
spacePOSTarrayThe disk space of the vpsNo
ramPOSTIntThe RAM value to be assigned to the vpsNo
swapramPOSTIntThe swap space assigned to the vps to be used as virtual RAMNo
bandwidthPOSTIntThe bandwidth to be assigned to the vpsNo
network_speedPOSTIntThe network speed to be used by the vpsNo
cpuPOSTIntThe CPU weight for the VPSNo
coresPOSTIntThe number of CPU Cores the vps will useNo
cpu_percentPOSTIntSet the CPU Percent, the vps could use out of the server CPUNo
vncPOST1/0If set, VNC access will be enabledNo
vncpassPOSTtextThis will change the vnc passwordNo
acpiPOST1/0If set, then acpi will be enabled for the vpsNo
apicPOST1/0If set, then apic will be enabled for the vpsNo
paePOST1/0If set, then pae will be enabled for the vpsNo
bootPOSTtextThe boot order (dca or cda) (Only for KVM and Xen HVM)No
ips_intPOSTarraySet the internal ip for the vpsNo
cpupinPOSTarrayPin the particular CPU Cores to this VPS (Only for KVM, Virtuozzo KVM,Virtuozzo OpenVz, XEN)No
upload_speedPOSTIntThis will set the upload speed of the vps in KB/sNo
virtPOSTtextType of virtualization using which vps was createdNo
band_suspendPOST1/0If set then the vps will be suspended once it exceeds the bandwidth limit assignedNo
hvmPOST1/0Pass value if it is hypervisor.Cannot be used while editing the vps.No
virtioPOST1/0Flag to enable VIRTIO (Only for KVM)No
cpu_modePOSTtextRefer Values from below tableNo
topology_socketsPOSTIntSpecify the number of CPU Sockets to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
topology_coresPOSTIntSpecify the number of CPU cores to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
topology_threadsPOSTIntSpecify the number of CPU Threads to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
kvm_cachePOSTtextThe type disk-cache mechanism can be writeback, writethrough, directsync or default (Only for KVM and Proxmox KVM)No
io_modePOSTtextSets the I/O policy for the VPS can be native/threads (Only for KVM)No
kvm_vgaPOST1/0Enables VGA for the VPS (Only for KVM)No
accelerationPOST1/0If VGA is enabled then this option will enable 2D and 3D acceleration will be for the VPSNo
disable_ebtablesPOST1/0Disable ebtables for the VPSNo
rdpPOST1/0IF set, then RDP will be enabled for windows vpsNo
vnc_keymapPOSTtextAllows 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_typePOSTtextThe NIC type (default or e1000) (Only for KVM and Xen)No
dnsPOSTarrayAdding DNS Nameservers to the vpsNo
osreinstall_limitPOSTIntIf you want to limit the number of OS re-installs per month.Eg. 0 – is unlimitedNo
admin_managedPOST1/0If checked, VPS can not be managed from Enduser panelNo
disable_nw_configPOST1/0This will disable network config of the vpsNo
mgsPOSTarrayThe media group assigned to the vpsNo
burstPOSTIntSet the burst RAM for the vps(Only for Open Vz and Proxmox)No
shadowPOSTIntAmount of Shadow Memory for the vpsNo
isoPOSTtextThe name of the iso file which will be used to install vpsNo
pv_on_hvmPOST1/0If set then it will be enabled for the vpsNo
tuntapPOST1/0Flag to enable tuntap (Only for OpenVZ)No
vif_typePOSTtextThe VIF type (netfront or ioemu) (Only for KVM and Xen HVM)No


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 )

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['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['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": "0",
    "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"
    ]
  }
}
Was this helpful to you?