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

Add IP Address — addip

Add new IP address(es) to WebHost Manager.

note Note: The addip function is only available for API version 0. For API version 1, use the addips function.

Calling Functions

Using the XML API

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

  • Append the /xml-api/addip 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/addip

  • 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 addip function from within your custom script:

  • Append the /json-api/addip 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/addip

  • 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

The addip function takes the following required variables as input:

  • ip (string) — IP address(es) to add to the server.
    • note Note: When you add multiple IP addresses, you must use Class C CIDR format.
  • netmask (string) — Subnet mask.

The addip function takes the following optional variable as input:

  • api.version (string) — This parameter tells the API to access Remote API v0 functions. If used, this parameter must be set to 0 to call this version of the function.

Output

Show Hide

  • addip — Root-level XML tag for the output of the addip function.
    • addip (string) — Container for the results of the IP address addition.
      • msgs (string) — Information about the IP address addition.
      • status (boolean) — Status of the request.
        • 1 — true.
        • 0 — false.
      • statusmsg (string) — Additional information from the server about the IP address addition.

Examples

XML API

Show Hide

Calling https://example.com:2087/xml-api/addip?ip=208.77.188.166&netmask=255.255.255.0 in WebHost Manager will produce output similar to the following:

<addip>
     <addip>
            <msgs>eth0:2 is now up.  208.77.188.166/255.255.255.0 broadcast 208.77.188.166 
             has been added System has 1 free ip.</msgs>
            <status>1</status>
            <statusmsg>Success</statusmsg>
      </addip>
</addip>

JSON API

Show Hide

Calling the URL https://example.com:2087/json-api/addip?ip=208.77.188.166&netmask=255.255.255.0 in WebHost Manager will produce output similar to:

{
   "addip":[
      {
         "errors":[

         ],
         "status":1,
         "statusmsg":"Success",
         "msgs":"eth0:4 is now up.  208.77.188.166/255.255.255.0 broadcast 208.77.188.255 
          has been added\nSystem has 4 free ips."
      }
   ]
}

Topic revision: r7 - 11 Jun 2013 - 18:58:29 - Main.SarahHaney