API Rebuild VPS

From Virtualizor Wiki
Jump to: navigation, search

Rebuild a VPS

Parameters Type Description
vpsid POST The id of the VPS
osid POST The id of the OS Template
newpass POST The new root password
conf POST The confirmation password
reos POST Flag to begin the reinstallation
serid POST The id of the Server

Example Code:

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

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

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

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['vpsid']=13;
    $post['osid']=272;
    $post['serid']=0;
    $post['newpass']=1234599;
    $post['conf']=1234599;
    $post['reos']=1;

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

Returns:

Array
(
    [title] => Rebuild Virtual Server
    [vpses] => Array
        (
            [vpsid] => 13
            [vps_name] => 1004
            [serid] => 0
            [time] => 1399983400
            [edittime] => 1400137041
            [virt] => kvm
            [uid] => 1
            [plid] => 0
            [hostname] => test123456799999999.com
            [osid] => 272
            [iso] => 
            [sec_iso] => 
            [boot] => cda
            [space] => 15
            [inodes] => 0
            [ram] => 1024
            [burst] => 0
            [swap] => 1024
            [cpu] => 1000
            [cores] => 4
            [cpu_percent] => 0.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
            [ips] => Array
                (
                    [0] => 192.168.111.61
                )

        )

    [ostemplates] => 
    [timenow] => 1400137053
    [time_taken] => 0.052
)