API List VS

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

List all VPS (Master and Slave)


Parameters Description
page_number If not specified, then only first 50 records are returned
count Number of records to be returned, default is 50

Example Code:

<?php

    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

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

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

    $output = $admin->vs(1, 20);
    
    print_r($output);

?>

Returns:

Array
(
    [title] => Virtual Servers
    [vs] => Array
        (
            [1011] => Array
                (
                    [vpsid] => 1011
                    [vps_name] => 1001
                    [serid] => 0
                    [time] => 1399724474
                    [edittime] => 1399875217
                    [virt] => kvm
                    [uid] => 11
                    [plid] => 0
                    [hostname] => test
                    [osid] => 270
                    [iso] => 
                    [sec_iso] => 
                    [boot] => cda
                    [space] => 5
                    [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] => 0
                    [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
                    [server_name] => localhost
                    [ips] => Array
                        (
                            [3707] => 192.168.166.222
                        )

                )

            [1012] => Array
                (
                    [vpsid] => 1012
                    [vps_name] => 1002
                    [serid] => 0
                    [time] => 1399871283
                    [edittime] => 1400058397
                .
				.
				.
				.
				

        )

    [ostemplates] => Array
        (
            [3] => Array
                (
                    [osid] => 3
                    [type] => openvz
                    [name] => centos-5-x86
                    [filename] => centos-5-x86.tar.gz
                    [size] => 182495369
                    [pygrub] => 0
                    [drive] => 
                    [hvm] => 0
                    [perf_ops] => 0
                    [active] => 1
                    [url] => http://files.virtualizor.com/ostemplates.php?osid=3
                    [distro] => centos
                )

            [4] => Array
                (
                    [osid] => 4
                    [type] => openvz
                    [name] => centos-5-x86_64
                    [filename] => centos-5-x86_64.tar.gz
                    [size] => 192755726
                    [pygrub] => 0
                    [drive] => 
                    [hvm] => 0
                .
				.
				.
				.
				

        )

    [servers] => Array
        (
            [0] => Array
                (
                    [serid] => 0
                    [sgid] => 0
                    [server_name] => localhost
                    [virt] => kvm
                    [ip] => 127.0.0.1
                    [lv] => vg
                    [hvm] => 0
                    [licnumvs] => 0
                    [total_ram] => 15825
                    [overcommit] => 0
                    [ram] => 14716
                    [total_space] => 1656
                    [space] => 1148
                    [checked] => 1400140867
                    [numvps] => 3
                    [alloc_ram] => 6117
                    [alloc_space] => 20
                    [alloc_cpu] => 1000
                    [alloc_cpu_percent] => 100.00
                    [alloc_bandwidth] => 0
                )

        )

    [timenow] => 1400141061
    [time_taken] => 0.050
)