An IP Pool is a collection of IPs which can be used to create VPS. Use the Search IP Pool API to search the IP pools present on your server. The API response will contain all the details of the IP pool listed according to their IDs.
See also: Add IP pool guide.
HTTP Request
https://hostname:4085/index.php?act=ippool&poolname=POOLNAME&poolgateway=POOLGATEWAY&netmask=NETMASK&nameserver=NAMESERVER&page=PAGE&reslen=RESLEN
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | ippool | The action will perform the operation and will return an array according to passed search parameters | Yes |
poolname | GET | text | The name of the ip pool | No |
poolgateway | GET | text | The gateway of the pool | No |
netmask | GET | text | The netmask of the pool | No |
nameserver | GET | text | The nameserver of the pool | No |
servers_search | Int | Search IPs using server ID (Specify -1 to get data from all servers) | No | |
reslen | GET | Int | Number of records to be returned, default is 50 | No |
page | GET | Int | Page number, each page show 50 records | No |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$page = 1;
$reslen = 10;
$post= array();
$post['poolname'] = 'Live IPv6';
$post['poolgateway'] = '';
$post['netmask'] = '';
$post['servers_search'] = '';
$post['nameserver'] = '';
$output = $admin->ippool($page, $reslen, $post);
print_r(json_encode($output));
?>
Output
{
"title": "IP Pool",
"ippools": {
"3": {
"ippid": "3",
"ipp_serid": "0",
"ippool_name": "Live IPv6",
"gateway": "2607:fa98:30:1::1",
"netmask": "64",
"ns1": "2001:4860:4860::8888",
"ns2": "2001:4860:4860::8844",
"ipv6": "1",
"nat": "0",
"nat_name": "",
"routing": "1",
"internal": "0",
"bridge": "",
"mtu": "0",
"vlan": "0",
"totalip": "50",
"freeip": "45"
}
},
"timenow": 1535385866,
"time_taken": "0.229"
}