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

Change a Site's (or User's) IP Address — setsiteip

This function allows you to change the IP address of a website, or a user account, hosted on your server.

Calling Functions

Using the XML API

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

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

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

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

  • 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 setsiteip function takes the following required variable as input:

  • ip (string) — The IP you wish to assign to the user or domain.

This function also takes the following optional variables as input:

  • user (string) — Username of the account whose IP address you wish to change.
    • note Note: This variable is not needed if the domain is specified.
  • domain (string) — Domain whose IP address you wish to change.
    • note Note: This variable is not needed if the user is specified.

Output

  • setsiteip — Root-level XML tag for the output of the setsiteip function.
    • result — Container for the information about the setsiteip function call.
      • status (boolean) — Whether the call was successful.
        • 1 — success.
        • 0 — failure.
      • statusmsg (string) — Status or error message about the setsiteip function call.

Examples

XML API

Calling the following function in WebHost Manager:

https://example.com:2087/xml-api/setsiteip?user=joe&ip=127.0.0.1

will produce output similar to:

<setsiteip>
     <result>
          <status>1</status>
          <statusmsg/>
     </result>
</setsiteip>

JSON API

Calling the following function in WebHost Manager:

https://example.com:2087/json-api/setsiteip?user=joe&ip=127.0.0.1

will produce output similar to:

{
   "result":[
      {
         "status":1,
         "statusmsg":null
      }
   ]
}

Topic revision: r2 - 29 Sep 2009 - 17:42:06 - MelanieSeibert