Child pages
  • WHM API 0 Functions - addip
Skip to end of metadata
Go to start of metadata

 

Description

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

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/addip?ip=192.168.0.20&netmask=255.255.255.0
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/addip?ip=192.168.0.20&netmask=255.255.255.0
 Command Line
whmapi0 addip ip=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 0 documentation or run the whmapi0 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
   "addip":[
      {
         "errors":[
 
         ],
         "status":1,
         "statusmsg":"Success",
         "msgs":"eth0:4 is now up.  192.168.0.20/255.255.255.0 broadcast 192.168.0.255 
          has been added\nSystem has 4 free ips."
      }
   ]
}
 Output (XML)
<addip>
     <addip>
            <msgs>eth0:2 is now up.  192.168.0.20/255.255.255.0 broadcast 192.168.0.255 
             has been added System has 1 free ip.</msgs>
            <status>1</status>
            <statusmsg>Success</statusmsg>
      </addip>
</addip>

   

Parameters

Parameter Type

Description

Possible valuesExample

ip

string

Required

The IPv4 address or addresses.

A valid IPv4 address or addresses in CIDR format.

192.168.0.20

192.168.0.20/28

netmaskstring

Required

The IP address' subnet mask.

A valid IPv4 address netmask.255.255.255.0

Returns

ReturnTypeDescriptionPossible valuesExample

addip

array of hashes

An array of hashes of the function's results.

This hash includes the msgs, status, and statusmsg returns and the errors array. 

errors

arrayA list of error messages.A list of valid strings.How about a nice tall glass of I Told You So, Morty?

msgs

string

The function's raw output.

This function returns this parameter in the addip hash.

A valid string.
 Click to view...
eth0:2 is now up.  192.168.0.20/255.255.255.0 broadcast 192.168.0.255 
has been added System has 1 free ip.

status

Boolean

Whether the function succeeded.

This function returns this parameter in the addip hash.

  • 1 — Success.
  • 0 — Failure.
1

statusmsg

string

A message of success or a reason for failure.

This function returns this parameter in the addip hash.

 A valid string.null