Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

List IP Addresses — listips

This function lists all IP addresses bound to network interfaces on the server.

Calling Functions

Using the XML API

To use the XML API to perform the listips function from within your custom script:

  • Append the /xml-api/listips function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/xml-api/listips

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Using the JSON API

To use the JSON API to perform the listips function from within your custom script:

  • Append the /json-api/listips function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/json-api/listips

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Variables

Input

None

Output

Show Hide
  • listips — Root-level XML tag for the output of the listips function.
    • result — Container for the list of IPs.
      • active (boolean) — Whether or not the IP is active.
        • 1 — yes.
        • 0 — no.
      • configured (boolean) — Whether or not the IP is configured on a network interface.
        • 1 — yes.
        • 0 — no.
      • if (string) — Network interface to which the IP is bound.
      • ip (string) — The IP in question.
      • mainaddr (boolean) — Whether or not the IP is the main IP used by the server.
        • 1 — yes.
        • 0 — no.
      • used (boolean) — Whether the IP is in use.
        • 1 — yes.
        • 0 — no.
      • removable (boolean) — Whether or not the IP can be removed.
        • 1 — yes.
        • 0 — no.

Examples

XML API

Show Hide

Calling https://example.com:2087/xml-api/listips in WebHost Manager will produce output similar to the following:

<listips>
     <result>
            <active>1</active>
            <configured>1</configured>
            <if>eth0</if>
            <ip>127.0.0.1</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>

JSON API

Show Hide

Calling the URL https://example.com:2087/json-api/listips in WebHost Manager will produce output similar to:

{
   "result":[
      {
         "used":1,
         "ip":"127.0.0.1",
         "removable":0,
         "active":1,
         "if":"eth0",
         "mainaddr":1
      },
      {
         "used":0,
         "ip":"208.77.188.166",
         "removable":1,
         "active":1,
         "if":"eth0:1",
         "mainaddr":0
      },
   ]
}

Topic revision: r5 - 29 Sep 2009 - 19:04:03 - MelanieSeibert