API Edit VPS

From Virtualizor Wiki
Jump to: navigation, search
NOTE
This is OLD API Documentation. Click on the following link for New API Documentation
Admin API

Edit a VPS

Parameters Required Description
vpsid The id of the VPS
rootpass The root password for the VPS
plid Optional The plan id for the VPS
hostname The hostname the VPS
space The disk space for the VPS
ram The ram for the VPS
bandwidth The network bandwidth for the VPS
network_speed Optional The network_speed for the VPS
cores The number of cores allotted to the VPS
uid The user id assigned to the VPS
osreinstall_limit Optional The number of times the user can reinstall the OS
mgs Optional Media groups ids (optional)
mac Optional The MAC Address for the VPS (Only for Xen and KVM)
priority The IO priority for the VPS (Only for OpenVZ)
cpu The CPU weight for the VPS
burst The burst RAM for the VPS (Only for OpenVZ)
cpu_percent The CPU Percent time for the VPS (Only for OpenVZ and Xen)
osid The id of the Operating System
iso Optional The ISO name (For Xen, KVM and XenServer only)
cpu The CPU weight for the VPS
tuntap Optional Flag to enable tuntap (0 or 1) (Only for OpenVZ)
vnc Optional Flag to enable vnc(0 or 1) (Only for KVM and Xen)
vncpass Optional The vnc password (Only for KVM and Xen)
swapram The amount of SWAP for the VPS (Only for KVM and Xen)
shadow The amount of shadow memory for the VPS (Only Xen HVM)
virtio Optional Flag to enable VIRTIO (0 or 1)(Only for KVM)
nic_type Optional The NIC type (default or e1000) (Only for KVM and Xen)
vif_type Optional The VIF type (netfront or ioemu) (Only for KVM and Xen HVM)
hvm Flag to enable hvm(0 or 1)(Only for Xen HVM)
band_suspend Optional Flag to suspend the VPS network (0 or 1)
boot Optional The boot order (dca or cda) (Only for KVM and Xen HVM)
ips The IP Address(s) for the VPS (Array)
admin_managed Optional Flag to enable Managed By Admin option (0 or 1)

Example SDK Code

<?php
    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

    $ip = 'xxx.xxx.xxx.xxx';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);
    
    $post['serid']=0;
    $post['uid']=1;
    $post['plid']=0;
    $post['iso']=0;
    $post['vpsid']=1012;
    $post['hostname']='test.com';
    $post['rootpass']='test';
    $post['ips']=array('192.168.xxx.xxx','192.168.xxx.xxx');
    $post['space']=15;
    $post['ram']=1024;
    $post['swapram']=1024;
    $post['bandwidth']=0;
    $post['network_speed']=0;
    $post['cpu']=1000;
    $post['cores']=4;
    $post['cpu_percent']=100;
    $post['vnc']=1;
    $post['vncpass']='test';
    $post['acpi']=1;
    $post['apic']=1;
    $post['pae']=1;
    $post['boot']='cda';
    $post['sec_iso']=0;
    $post['kvm_cache']=0;
    $post['io_mode']=0;
    $post['vnc_keymap']='en-us';
    $post['nic_type']='default';
    $post['dns']=array('4.2.2.1','4.2.2.2');
    $post['osreinstall_limit']=0;
    $post['admin_managed']=0

    $output = $admin->editvs($post);
    print_r($output);
?>

Returns:

Array
(
    [title] => Edit Virtual Server
    [error] => Array
        (
        )
    [vs_info] => Array
        (
            [vpsid] => 13
            [vps_name] => 1004
            [serid] => 0
            [time] => 1399983400
            [edittime] => 1400135915
            [virt] => kvm
            [uid] => 1
            [plid] => 0
            [hostname] => test123456799999999.com
            [osid] => 270
            [iso] => 
            [sec_iso] => 
            [boot] => cda
            [space] => 15
            [inodes] => 0
            [ram] => 1024
            [burst] => 0
            [swap] => 1024
            [cpu] => 1000
            [cores] => 4
            [cpu_percent] => 100.00
            [bandwidth] => 0
            [network_speed] => 0
            [io] => 0
            [ubc] => 
            [acpi] => 1
            [apic] => 1
            [pae] => 1
            [shadow] => 0
            [vnc] => 1
            [hvm] => 0
            [suspended] => 0
            [rescue] => 0
            [band_suspend] => 0
            [tuntap] => 0
            [ppp] => 0
            [ploop] => 0
            [dns_nameserver] => a:2:{i:0;s:7:"4.2.2.1";i:1;s:7:"4.2.2.2";}
            [osreinstall_limit] => 0
            [preferences] => 
            [nic_type] => default
            [vif_type] => 
            [virtio] => 0
            [disk] => 
            [kvm_cache] => 0
            [io_mode] => 0
            [vnc_keymap] => en-us
            [routing] => 0
            [mg] => 
            [webuzo] => 0
            [admin_managed] => 0
        )
)