Use the List IPs API to list IP addresses present on your server. The list will contain both IPv6 and IPv4 type of IPs, along with their details about the IP pool and the VPS to which they belong. If the IPs are not used by any VPS then their "vpsid" will be shown as "0". To limit the size of the list you can use the page and reslen parameters.
HTTP Request
https://hostname:4085/index.php?act=ips
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | ips | The action specified to carry out the operation and return list of ips | Yes |
page | POST | Int | If not specified, then only first 50 records are returned | Yes |
reslen | POST | Int | Number of records to be returned, default is 50 | Yes |
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 = 20;
$output = $admin->ips($page,$reslen,$post);
print_r(json_encode($output));
?>
Output
{
"title": "IP List",
"ips": {
"259": {
"ipid": "259",
"ippid": "3",
"ip_serid": "0",
"vpsid": "0",
"ip": "2607:fa98:0030:0001:0000:0002:e9ca:c606",
"ipv6": "1",
"ipr_netmask": "",
"primary": "0",
"ipr_ips": null,
"mac_addr": "",
"locked": "0",
"note": null,
"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",
"nat": "0",
"nat_name": "",
"routing": "1",
"internal": "0",
"bridge": "",
"mtu": "0",
"vlan": "0",
"hostname": null
},
"261": {
"ipid": "261",
"ippid": "3",
"ip_serid": "0",
"vpsid": "0",
"ip": "2607:fa98:0030:0001:0000:0002:f22b:74e3",
"ipv6": "1",
"ipr_netmask": "",
"primary": "0",
"ipr_ips": null,
"mac_addr": "",
"locked": "0",
"note": null,
"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",
"nat": "0",
"nat_name": "",
"routing": "1",
"internal": "0",
"bridge": "",
"mtu": "0",
"vlan": "0",
"hostname": null
}
},
"timenow": 1535384540,
"time_taken": "0.218"
}