API List Servers

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

Get the list of all servers

Parameters Description
N/A N/A

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->servers();
    
    print_r($output);

?>

Returns:

Array
(
    [title] => Servers
    [servs] => 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] => 15861
                    [overcommit] => 0
                    [ram] => 9642
                    [total_space] => 4095
                    [space] => 3808
                    [checked] => 1400493662
                    [numvps] => 9
                    [alloc_ram] => 22512
                    [alloc_space] => 175
                    [alloc_cpu] => 4024
                    [alloc_cpu_percent] => 400.00
                    [alloc_bandwidth] => 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] => 15861
                    [overcommit] => 0
                    [ram] => 9642
                    [total_space] => 4095
                    [space] => 3808
                    [checked] => 1400493662
                    [numvps] => 9
                    [alloc_ram] => 22512
                    [alloc_space] => 175
                    [alloc_cpu] => 4024
                    [alloc_cpu_percent] => 400.00
                    [alloc_bandwidth] => 0
                )

        )

    [timenow] => 1400496128
    [time_taken] => 0.013
)