Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function lists available IP addresses on the server.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/listips
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/listips
 Command Line
whmapi0 listips

Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
   "result":[
      {
         "used":1,
         "ip":"192.168.0.20",
         "removable":0,
         "active":1,
         "if":"eth0",
         "mainaddr":1
      },
      {
         "used":0,
         "ip":"208.77.188.166",
         "removable":1,
         "active":1,
         "if":"eth0:1",
         "mainaddr":0
      },
   ]
}
 Output (XML)
<listips>
    <result>
        <active>1</active>
        <configured>1</configured>
        <if>eth0</if>
        <ip>192.168.0.20</ip>
        <mainaddr>1</mainaddr>
        <removable>0</removable>
        <used>1</used>
    </result>
    <result>
        <active>1</active>
        <configured>1</configured>
        <if>eth0:1</if>
        <ip>208.77.188.166</ip>
        <mainaddr>0</mainaddr>
        <removable>1</removable>
        <used>0</used>
    </result>
</listips>

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
listipshash

A hash of the function call's results.

This hash includes the result hash. 

result

array of hashes

An array of hashes of an IP address's information.

This hash includes the used, ip, removable, activeif, and maindir returns. 

used

Boolean

Whether the IP address is currently in use.

This function returns this value in the result hash.

  • 1 — In use.
  • 0Not in use.
1

ip

string

The IP address.

This function returns this value in the result hash.

A valid IP address.

208.77.188.166

removable

Boolean

Whether the IP address is removable.

This function returns this value in the result hash.

  • 1 — Removable.
  • 0Not removable.
1

active

Boolean

Whether the IP address is active.

This function returns this value in the result hash.

  • 1 — Active.
  • 0 — Inactive.
1

if

string

The IP address' network interface.

This function returns this value in the result hash.

A valid device name.
eth0

maindir

Boolean

Whether the IP address is the server's main IP address.

This function returns this value in the result hash.

  • 1 — Main IP address.
  • 0Not the main IP address.
0