Get Virtualizor

Search IPs

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

NameMethodValueDescriptionRequired
actGETipsThe action will search for the specified ip or any related parametersYes
ipsearchGETIPThe ip that needs to be searchedNo
ippoolsearchGETtextSearch IPs belonging to the ippoolNo
ippidGETintSearch IPs belonging to the ippool using ippool IDNO
macsearchGETtextSearch using IPs according to assigned mac IDNo
vps_searchGETtextSearch IPs using vps hostnameNo
servers_searchGETIntSearch IPs using server IDNo
lockedsearchGETtextSearch Ips based on their locked status (showlocked/hidelocked)No
reslenGETIntNumber of records to be returned, default is 50No
pageGETIntPage number, each page show 50 recordsNo

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"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list