Child pages
  • WHM API 1 Functions - listips
Skip to end of metadata
Go to start of metadata

 

Description

This function lists a server's IP addresses.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/listips?api.version=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/listips?api.version=1
 Command Line
whmapi1 listips


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "data": {
    "ip": [
      {
        "network": "192.168.0.0",
        "ip": "192.168.0.20",
        "active": 1,
        "if": "eth0",
        "mainaddr": 1,
        "removable": 0,
        "used": 1,
        "dedicated": 0,
        "netmask": "255.255.0.0"
      },
    ]
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": 1,
    "command": "listips"
  }
}
 Output (XML)
<result>
    <data>
        <ip>
            <network>192.168.0.0</network>
            <ip>192.168.0.20</ip>
            <active>1</active>
            <if>eth0</if>
            <mainaddr>1</mainaddr>
            <removable>0</removable>
            <used>1</used>
            <dedicated>0</dedicated>
            <netmask>255.255.0.0</netmask>
        </ip>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>listips</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

   

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
iparray of hashes

An array of hashes that contain IP address information.

The array of hashes includes the network, dedicated, netmask, active, configured, if, ip, mainaddr, used, and removable returns.
 

network

string

The IP address' network value.

The function returns this value in the ip hash.

A valid IPv4 address network value.
192.168.0.0

 

dedicated

BooleanWhether the IP address is dedicated.

The function returns this parameter in the ip hash.

  • 1 — Dedicated.
  • 0 — Shared.
0

netmask

stringThe IP address' netmask.

The function returns this value in the ip hash.

A valid IPv4 address netmask value.
255.255.0.0

active

BooleanWhether the IP address is active.

The function returns this parameter in the ip hash.

  • 1 — Active.
  • 0 — Inactive.
1

configured

BooleanWhether the IP address is configured to a network interface.

The function returns this value in the ip hash.

  • 1 — Configured.
  • 0Not configured.
1

if

stringThe IP address' network interface.

The function returns this value in the ip hash.

A valid network interface.
eth0

ip

stringThe IP address.

The function returns this value in the ip hash.

A valid IPv4 address.
192.168.0.20

mainaddr

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

The function returns this value in the ip hash.

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

used

BooleanWhether the IP address is in use.

The function returns this value in the ip hash.

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

removable

BooleanWhether the IP address can be removed.

The function returns this value in the ip hash.

  • 1 — Removable.
  • 0Not removable.
0