Description

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

Examples


https://hostname.example.com:2087/cpsess##########/json-api/addip?ip=192.168.0.20&netmask=255.255.255.0
https://hostname.example.com:2087/cpsess##########/xml-api/addip?ip=192.168.0.20&netmask=255.255.255.0
whmapi0 addip ip=192.168.0.20 netmask=255.255.255.0

{
   "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."
      }
   ]
}
<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.
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