Get Virtualizor

Edit VM

Use Edit VM API to edit existing VPS on your server.

This function is for cloud user

HTTP Request

https://hostname:4083/index.php?act=editvm&vid=vpsid

Parameters

NameTypeValueDescriptionRequired
actGETeditvmRetrieves information regarding a particular pageYes
vidGETIntRetrieves all information regarding the particular vps. This will be passed in the URLYes
vidPOSTIntThe vpsid that needs to be edited. This will be specified as a POST Parameter during callYes
editvmPOST1IF set then the vm will editedYes
uidPOSTIntThe user whose vps needs to be editedYes
hostnamePOSThostnameThis sets the hostname of the vpsYes
spacePOSTspaceThis gives the disk size to the vpsYes
ramPOSTramThis sets the RAM of the vpsYes
bandwidthPOSTbandwidthThis sets the bandwidth for the vpsYes
burstPOSTburstThis will let user edit the burst ram. (For OpenVZ)Yes
coresPOSTcoresThis sets the CPU coresYes
rootpassPOSTrootpassSets the root password of the vpsNo
swapramPOSTswapramSwap RAM is setYes
vncPOST1/0This enables VNC for accessing the vpsYes
ipsPOSTipsThis sets number of ips for the vpsYes
ips_intPOSTIntNumber of internal ip addresses that will be assigned to the vpsNo
ipv6POSTIntNumber of ipv6 addresses that will be assigned to the vpsNo
ipv6_subnetPOSTIntNumber of ipv6 subnet that will be assigned to the vpsNo

Sample Code

PHP

<?php
    require_once('/usr/local/virtualizor/sdk/enduser.php');

    $key =  '';
    $pass = '';
    $ip = '';
    $admin = new Virtualizor_Enduser_API($ip, $key, $pass);
    $post = array();
    $post['editvm'] = 1;
    $post['uid'] = 299;
    $post['hostname'] = 'test-adpi-edit';
    $post['space'] = 7 ;
    $post['ram'] = 2048;
    $post['bandwidth'] = 0;
    $post['cores'] = 4;
    $post['rootpass'] = 'test@123';
    $post['swapram'] = 1024;
    $post['vnc'] = 1;
    $post['ips'] = 3;

    $vid = 3511;

    $output = $admin->editvm($vid, $post);
    print_r(json_encode($output));
?>

Curl

curl -k -X POST -d "editvm=1&uid=372&hostname=testmic_23&ram=1024
&swap=1024&cores=4&space=42&bandwidth=1&vnc=1&ips=1" -L 
"https://hostname:4083/index.php?act=editvm&vid=3588&api=json&
apikey=you_api_key&apipass=your_api_pass&do=1"

Output

{
    "uid": "326",
    "act": "editvm",
    "timezone": 1,
    "timenow": "September 26, 2016, 7:47 am",
    "vpsid": "3260",
    "username": "test@test.com",
    "user_type": "2",
    "preferences": {
        "fname": "",
        "lname": "",
        "theme": "default",
        "language": "english",
        "timezone": 1
    },
    "url": "index.php?",
    "rdns": {
        "pdnsid": null
    },
    "support_link": "http://softaculous.com",
    "disable_login_logo": 1,
    "title": "Edit VPs",
    "resources": {
        "num_vs": 27,
        "num_users": 20,
        "space": 907,
        "ram": 93656,
        "burst": 10000,
        "bandwidth": 49991.81,
        "num_ipv4": 997,
        "num_ipv6_subnet": 10000,
        "num_ipv6": "10000",
        "cores": "4",
        "num_cores": 9988,
        "network_speed": "0",
        "upload_speed": "0",
        "allowed_virts": {
            "openvz": "openvz",
            "kvm": "kvm"
        },
        "cloud_allow_virtio": 1
    },
    "usage": {
        "num_cores": 12
    },
    "users": {
        "326": {
            "uid": "326",
            "email": "test@test.com"
        }
    },
    "ostemplates": {
        "272": {
            "osid": "272",
            "type": "kvm",
            "name": "centos-6.5-x86_64",
            "filename": "centos-6.5-x86_64.img",
            "size": "1074855936",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "1",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=272",
            "distro": "centos",
            "Nvirt": "kvm"
        },
        "334": {
            "osid": "334",
            "type": "kvm",
            "name": "centos-7.0-x86_64",
            "filename": "centos-7.0-x86_64.img",
            "size": "1291845632",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "1",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=334",
            "distro": "centos",
            "Nvirt": "kvm",
            "mg": [16]
        },
        "347": {
            "osid": "347",
            "type": "kvm",
            "name": "centos-6.6-x86_64",
            "filename": "centos-6.6-x86_64.img",
            "size": "1074855936",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "1",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=347",
            "distro": "centos",
            "Nvirt": "kvm"
        },
        "381": {
            "osid": "381",
            "type": "kvm",
            "name": "centos-7.1-x86_64",
            "filename": "centos-7.1-x86_64.img",
            "size": "1074855936",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "1",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=381",
            "distro": "centos",
            "Nvirt": "kvm"
        },
    },
    "done": {
        "msg": "The Virtual Server has been successfully edited",
        "goto": "act=listvs"
    },
    "done_msg": "The Virtual Server has been successfully edited",
    "res_limit": {
        "num_vs": "30",
        "num_users": "20",
        "space": "1000",
        "ram": "100000",
        "bandwidth": "50000",
        "num_ipv4": "1000",
        "num_ipv6_subnet": "10000",
        "num_ipv6": "10000",
        "num_cores": "10000",
        "cores": "4"
    },
    "vps": {
        "vpsid": "3579",
        "vps_name": "v2104",
        "uuid": "6bhdgofgqflyqhbm",
        "serid": "1",
        "time": "0",
        "edittime": "1474872192",
        "virt": "kvm",
        "uid": "326",
        "plid": "0",
        "hostname": "testmic123",
        "osid": "334",
        "os_name": "centos-7.0-x86_64",
        "iso": "",
        "sec_iso": "",
        "boot": "cda",
        "space": "40",
        "inodes": "0",
        "ram": "2048",
        "burst": "0",
        "swap": "0",
        "cpu": "1024",
        "cores": "4",
        "cpupin": "-1",
        "cpu_percent": "0.00",
        "bandwidth": "1",
        "network_speed": "1024",
        "upload_speed": "0",
        "io": "0",
        "ubc": false,
        "acpi": "1",
        "apic": "1",
        "pae": "1",
        "shadow": "0",
        "vnc": "1",
        "vncport": "5945",
        "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:0:{}",
        "osreinstall_limit": "0",
        "preferences": null,
        "nic_type": "e1000",
        "vif_type": "",
        "virtio": "0",
        "pv_on_hvm": "0",
        "kvm_cache": "0",
        "io_mode": "0",
        "cpu_mode": "",
        "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",
        "webuzo": "0",
        "disable_ebtables": "0",
        "admin_managed": "0",
        "rdp": "0",
        "topology_sockets": "0",
        "topology_cores": "0",
        "topology_threads": "0",
        "mac": "",
        "notes": "",
        "disable_nw_config": "1",
        "pid": "0",
        "ips": {
            "76463": "xx.xx.xx.xx"
        },
        "distro": "centos"
    },
    "time_taken": "4.842"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list