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



integrationblogcta.jpg

Add IP Address — addip

Add new IP address(es) to WebHost Manager.

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(s) to add to the server.
    • note Note: When adding multiple IP addresses, you must use Class C CIDR format.
  • netmask (string) — Subnet mask.

Output

Show Hide

  • addip — Root-level XML tag for the output of the addip function.
    • addip (string) — Container for the results of the IP addition.
      • msgs (string) — Information about the IP addition.
      • status (boolean) — Status of the request.
        • 1 — true.
        • 0 — false.
      • statusmsg (string) — Additional information from the server about the IP 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: r6 - 29 Sep 2009 - 18:48:16 - MelanieSeibert