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

 

Description

This function adds an IPv4 address or addresses to the server.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/addips?api.version=1&ips=192.168.0.20&netmask=255.255.255.0
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/addips?api.version=1&ips=192.168.0.20&netmask=255.255.255.0
 Command Line
whmapi1 addips ips=192.168.0.20 netmask=255.255.255.0


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)
{
  "metadata": {
    "version": 1,
    "reason": "Success",
    "output": {
      "messages": [
        "eth0:cp1 is now up. 192.168.0.20/255.255.255.0 broadcast 192.168.0.255 has been added.",
        "1"
      ]
    },
    "result": 1,
    "command": "addips"
  }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <reason>Success</reason>
        <output>
            <messages>
                eth0:cp1 is now up. 192.168.0.20/255.255.255.0 broadcast 192.168.0.255 has been added.
            </messages>
            <messages>1</messages>
        </output>
        <result>1</result>
        <command>addips</command>
    </metadata>
</result>


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample
ipsstring

Required

The IPv4 address or addresses.

A valid IPv4 address or address range in Class C CIDR format.
192.168.0.0

192.168.0.20/28

netmaskstring

Required

The IPv4 address' netmask.

 

A valid IPv4 netmask address.

If the ips parameter is in Class C CIDR format, the range mask must be a value from 24 through 30.

255.255.255.0
excludesstring

An IPv4 address or addresses to exclude.

If you do not specify a value, the function does not exclude any IPv4 addresses.

A comma-delimited list of IPv4 addresses.192.168.0.1,192.168.0.2

Returns

Note:

This function outputs these returns in the metadata.


ReturnTypeDescriptionPossible valuesExample
outputhash

A hash of output messages.

The hash includes the messages return.
 

messages

array

An array of the function call's raw output.

The function returns this array in the output hash.

An array of valid strings.
 Click to view...
eth0:cp1 is now up. 192.168.0.20/255.255.255.0 broadcast 192.168.0.255 has been added.