Use the Search IP API to search the IP addresses present on your server. The API response will contain a array of IPs consisting of 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".
HTTP Request
https://hostname:4085/index.php?act=ips&ipsearch=IPSSEARCH&ippoolsearch=IPPOOLSEARCH&
\macsearch=MACSEARCH&vps_search=VPSSEARCH&servers_search=SERVDERSEARCH&lockedsearch=-1&page=PAGE&reslen=RESLEN
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | ips | The action will search for the specified ip or any related parameters | Yes |
ipsearch | GET | IP | The ip that needs to be searched | No |
ippoolsearch | GET | text | Search IPs belonging to the ippool | No |
ippid | GET | int | Search IPs belonging to the ippool using ippool ID | NO |
macsearch | GET | text | Search using IPs according to assigned mac ID | No |
vps_search | GET | text | Search IPs using vps hostname | No |
servers_search | GET | Int | Search IPs using server ID | No |
lockedsearch | GET | text | Search Ips based on their locked status (showlocked/hidelocked) | 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['ipsearch'] = '192.168.2.110';
$post['ippoolsearch'] = '';
$post['macsearch'] = '';
$post['vps_search'] = '';
$post['servers_search'] = '';
$post['lockedsearch'] = '';
$output = $admin->ips( $page,$reslen ,$post);
print_r($output);
?>
Output
{
"title": "IP List",
"ips": {
"262": {
"ipid": "262",
"ippid": "3",
"ip_serid": "0",
"vpsid": "0",
"ip": "2607:fa98:0030:0001:0000:0002:341e:0945",
"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
},
"276": {
"ipid": "276",
"ippid": "3",
"ip_serid": "0",
"vpsid": "64",
"ip": "2607:fa98:0030:0001:0000:0002:0bc7:c4e7",
"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": "www.mydomain.com"
}
},
"timenow": 1535387001,
"time_taken": "0.228"
}