API Edit IP Pool

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 IP Pool

Parameters Description
ippool_name Name of the IP Pool
gateway The Gateway address
netmask Netmask Address
ns1 Name Server Address 1
ns2 Name Server Address 2
serid Server Id
ippid Ip Pool id to be edited

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['ippool_name'] = 'test';
    $post['gateway']     = '192.168.1.1';
    $post['netmask']     = '255.255.255.0';
    $post['ns1']		 = '4.2.2.1';
    $post['ns2']  		 = '4.2.2.2';
    $post['serid']       = array(0);
    $post['ippid']       = '252';
    
    $output = $admin->editippool($post);
    print_r($output);
?>

Returns:

Array
(
    [title] => Edit IP Pool
    [done] => 1
    [ippool] => 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] => natbr252
            [routing] => 0
            [serid] => 0
        )

    [ippid] => 252
    [ippool_servers] => Array
        (
            [252|0|-2] => Array
                (
                    [ippid] => 252
                    [serid] => 0
                    [sgid] => -2
                )

        )

    [timenow] => 1403075631
    [time_taken] => 0.017
)