API List IPPools

From Virtualizor Wiki
Jump to: navigation, search

Get list of IP Pools


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->ippool(1, 50);
    
    print_r($output);

?>

Returns:

Array
(
    [title] => IP Pool
    [ippools] => Array
        (
            [248] => Array
                (
                    [ippid] => 248
                    [ipp_serid] => 0
                    [ippool_name] => poolv6
                    [gateway] => fe80::1
                    [netmask] => 64
                    [ns1] => 8.8.8.8
                    [ns2] => 8.8.4.4
                    [ipv6] => 1
                    [nat] => 0
                    [nat_name] => 
                    [routing] => 0
                    [totalip] => 50
                    [freeip] => 50
                )

            [249] => Array
                (
                    [ippid] => 249
                    [ipp_serid] => 0
                    [ippool_name] => pool
                    [gateway] => xxx.xxx.xxx.xxx
                    [netmask] => 255.255.255.0
                    [ns1] => 4.2.2.1
                    [ns2] => 4.2.2.2
                    [ipv6] => 0
                    [nat] => xxx.xxx.xxx.xxx-xxx.xxx.xxx.xxx
                    [nat_name] => natbr2365
                    [routing] => 0
                    [totalip] => 7
                    [freeip] => 1
                )

            [251] => Array
                (
                    [ippid] => 251
                    [ipp_serid] => 0
                    [ippool_name] => pool66
                    [gateway] => 192.168.1.1
                    [netmask] => 255.255.255.0
                    [ns1] => 4.4.2.2
                    [ns2] => 4.2.2.1
                    [ipv6] => 0
                    [nat] => 0
                    [nat_name] => 
                    [routing] => 0
                    [totalip] => 4
                )

            [252] => Array
                (
                    [ippid] => 252
                    [ipp_serid] => 0
                    [ippool_name] => test
                    [gateway] => 192.168.1.1
                    [netmask] => 255.255.255.0
                    [ns1] => 4.2.2.1
                    [ns2] => 4.2.2.2
                    [ipv6] => 0
                    [nat] => 192.168.1.2-192.168.1.5
                    [nat_name] => natbr2525
                    [routing] => 0
                    [totalip] => 2
                )

        )

    [timenow] => 1101113758
    [time_taken] => 0.016
)