| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs |
| |
There are several possible applications of the XML and JSON APIs. For example, they can make managing a data center easy by allowing you to issue a single command across multiple servers. |
|
< < | For information about parsing XML output, visit our Parsing XML document. |
> > | For information about parsing XML output, visit our Parsing XML document. |
| |
Important: The JSON API is much less resource-intensive than the XML API. We highly recommend using the JSON API, especially if performance is important, since it provides much faster results. |
| |
-
-
https://example.com:2087/xml-api/functionname
-
https://example.com:2087/json-api/functionname
|
|
< < |
- 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 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 used in XML and JSON function calls |
|
< < | In addition to the input and output variables detailed here, each function call has its own distinct variables and output. For complete information about the function you wish to use, see the list of API functions below. |
> > | In addition to the input and output variables detailed here, each function call has its own distinct variables and output. For complete information about the function you wish to use, see the list of API functions below. |
| |
Input |
| |
For calls which perform an action |
|
> > | |
| | <-- SyntaxHighlightingPlugin -->
<name_of_XMLAPI_call>
<result (status of the request) />
</name_of_XML_API_call>
<-- end SyntaxHighlightingPlugin --> |
|
> > | |
| |
For calls which only request data |
|
> > | |
| | <-- SyntaxHighlightingPlugin -->
<name_of_XMLAPI_call>
<item (information about the item) />
("Item" is the item request, such as a package, account, etc.)
</name_of_XML_API_call>
<-- end SyntaxHighlightingPlugin --> |
|
> > | |
| |
Example
Calling this URL in WebHost Manager: /xml-api/setupreseller?user=bob&makeowner=1 will produce XML similar to: |
|
> > | |
| | <-- SyntaxHighlightingPlugin -->
<setupreseller>
<result status="1" statusmsg=""/>
</setupreseller>
<-- end SyntaxHighlightingPlugin --> |
|
> > | |
| | woops, ordering error: got an ENDTWISTY before seeing a TWISTY
JSON output format |
| |
Show Hide <--/twistyPlugin twikiMakeVisibleInline-->
For calls which perform an action |
|
> > |
|
| | %CODE{lang="javascript"}%
{
"result":[ |
| | ]
}
%ENDCODE% |
|
> > | |
| |
For calls which only request data |
|
> > |
|
| | %CODE{lang="javascript"}%
{
"status":1, |
| | ]
}
%ENDCODE% |
|
> > | |
| |
Example
Calling this URL in WebHost Manager: /json-api/setupreseller?user=bob&makeowner=1 will produce JSON output similar to: |
|
> > | |
| | %CODE{lang="javascript"}%
{
"result":[ |
| | ]
}
%ENDCODE% |
|
> > | |
| | <--/twistyPlugin-->
Functions |
|
< < | List Available API Calls (applist) — This function lists all XML/JSON API functions available to you. |
> > | List Available API Calls (applist) — This function lists all XML/JSON API functions available to you. |
| | |
|
< < | Call the cPanel API1 and API2 commands (cpanel) — You can use the XML and JSON APIs to access cPanel API versions 1 and 2. |
> > | Call the cPanel API1 and API2 commands (cpanel) — You can use the XML and JSON APIs to access cPanel API versions 1 and 2. |
| |
Account functions |
|
< < | Create an Account (createacct) — This API function allows you to create new cPanel accounts. |
> > | Create an Account (createacct) — This API function allows you to create new cPanel accounts. |
| | |
|
< < | Change an Account's Password (passwd) — Using this API function, you can change a cPanel account's password. |
> > | Change an Account's Password (passwd) — Using this API function, you can change a cPanel account's password. |
| | |
|
< < | Limit Bandwidth Usage (Transfer) (limitbw) — This API function allows you to change bandwidth limits for cPanel accounts. |
> > | Limit Bandwidth Usage (Transfer) (limitbw) — This API function allows you to change bandwidth limits for cPanel accounts. |
| | |
|
< < | List Accounts (listaccts) — This API function will generate a list of accounts associated with a server. |
> > | List Accounts (listaccts) — This API function will generate a list of accounts associated with a server. |
| | |
|
< < | Modify an Account (modifyacct) — Using this API function, you are able to change specific attributes of cPanel accounts, such as the theme or domain. |
> > | Modify an Account (modifyacct) — Using this API function, you are able to change specific attributes of cPanel accounts, such as the theme or domain. |
| | |
|
< < | Edit Quota (editquota) — This API function allows you to edit a user's disk space quota. |
> > | Edit Quota (editquota) — This API function allows you to edit a user's disk space quota. |
| | |
|
< < | Show an Account's Information (accountsummary) — This API function will generate a list of an account's attributes, such as its IP address and partition. |
> > | Show an Account's Information (accountsummary) — This API function will generate a list of an account's attributes, such as its IP address and partition. |
| | |
|
< < | Suspend an Account (suspendacct) — Using this API function, you can prevent a user from accessing his or her cPanel account. |
> > | Suspend an Account (suspendacct) — Using this API function, you can prevent a user from accessing his or her cPanel account. |
| | |
|
< < | List Suspended Accounts (listsuspended) — This function allows you to view a list of suspended accounts on your server. |
> > | List Suspended Accounts (listsuspended) — This function allows you to view a list of suspended accounts on your server. |
| | |
|
< < | Terminate an Account (removeacct) — This API function allows you permanently remove an account from a server. |
> > | Terminate an Account (removeacct) — This API function allows you permanently remove an account from a server. |
| | |
|
< < | Unsuspend an Account (unsuspendacct) — Using this API function, you can allow a user to access his or her cPanel account after it has been suspended. |
> > | Unsuspend an Account (unsuspendacct) — Using this API function, you can allow a user to access his or her cPanel account after it has been suspended. |
| | |
|
< < | Upgrade or Downgrade an Account (changepackage) — This API function allows you to change the hosting plan associated with a cPanel account. |
> > | Upgrade or Downgrade an Account (changepackage) — This API function allows you to change the hosting plan associated with a cPanel account. |
| | |
|
< < | View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. |
> > | View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. |
| | |
|
< < | Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain. This information includes whether or not CGI aliasing is enabled, log locations, and other details. |
> > | Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain. This information includes whether or not CGI aliasing is enabled, log locations, and other details. |
| | |
|
< < | Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. |
> > | Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. |
| | |
|
< < | Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. This function is only available in version 11.27/11.28+. |
> > | Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. This function is only available in version 11.27/11.28+. |
| |
DNS functions |
|
< < | Note: If you wish to change the IP in a zone record, you may find the swapip script more suitable than an API function. |
> > | Note: If you wish to change the IP in a zone record, you may find the swapip script more suitable than an API function. |
| | |
|
< < | Add a DNS Zone (adddns) — This API function lets you create a DNS zone. |
> > | Add a DNS Zone (adddns) — This API function lets you create a DNS zone. |
| | |
|
< < | Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. |
> > | Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. |
| | |
|
< < | |
> > | |
| | |
|
< < | Edit a Zone Record (editzonerecord) — This function allows you to edit an existing zone record. |
> > | Edit a Zone Record (editzonerecord) — This function allows you to edit an existing zone record. |
| | |
|
< < | Get a Zone Record (getzonerecord) — This function allows you to view DNS zone records associated with a given domain. |
> > | Get a Zone Record (getzonerecord) — This function allows you to view DNS zone records associated with a given domain. |
| | |
|
< < | Delete a DNS Zone (killdns) — This API function lets you delete a DNS zone. |
> > | Delete a DNS Zone (killdns) — This API function lets you delete a DNS zone. |
| | |
|
< < | List All DNS Zones (listzones) — This API function lists all domains and DNS zones on your server. |
> > | List All DNS Zones (listzones) — This API function lists all domains and DNS zones on your server. |
| | |
|
< < | List (Dump) 1 Zone (dumpzone) — This API function displays the DNS zone configuration for a specific domain. |
> > | List (Dump) 1 Zone (dumpzone) — This API function displays the DNS zone configuration for a specific domain. |
| | |
|
< < | Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver. |
> > | Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver. |
| | |
|
< < | Remove a DNS Zone Record (removezonerecord) — This function allows you to remove a zone record from the server. |
> > | Remove a DNS Zone Record (removezonerecord) — This function allows you to remove a zone record from the server. |
| | |
|
< < | Reset a DNS Zone (resetzone) — This API function will reset a DNS zone to its default values. |
> > | Reset a DNS Zone (resetzone) — This API function will reset a DNS zone to its default values. |
| | |
|
< < | Resolve an IP Address from a Domain (resolvedomainname) — This function allows you to resolve the IP address of a specified domain. This function is only available in version 11.27/11.28+. |
> > | Resolve an IP Address from a Domain (resolvedomainname) — This function allows you to resolve the IP address of a specified domain. This function is only available in version 11.27/11.28+. |
| | |
|
< < | List a Domain's MX Records (listmxs) — This function will retrieve a list of a domain's MX records. This function is only available in version 11.27/11.28+. |
> > | List a Domain's MX Records (listmxs) — This function will retrieve a list of a domain's MX records. This function is only available in version 11.27/11.28+. |
| | |
|
< < | Create a new MX Record (savemxs) — This function allows you to create a new MX record. This function is only available in version 11.27/11.28+. |
> > | Create a new MX Record (savemxs) — This function allows you to create a new MX record. This function is only available in version 11.27/11.28+. |
| |
Package functions |
|
< < | Add a Package (addpkg) — This API function adds a hosting package to your server. |
> > | Add a Package (addpkg) — This API function adds a hosting package to your server. |
| | |
|
< < | Delete a Package (killpkg) — This API function deletes a hosting package from your server. |
> > | Delete a Package (killpkg) — This API function deletes a hosting package from your server. |
| | |
|
< < | Edit a Package (editpkg) — This function lets you edit aspects of a hosting package. |
> > | Edit a Package (editpkg) — This function lets you edit aspects of a hosting package. |
| | |
|
< < | List Packages (listpkgs) — This API function lets you view all hosting packages available to the user. |
> > | List Packages (listpkgs) — This API function lets you view all hosting packages available to the user. |
| | |
|
< < | List Available Features (getfeaturelist) — This function lists available features that you can assign to packages. This function is only available in version 11.27/11.28+. |
> > | List Available Features (getfeaturelist) — This function lists available features that you can assign to packages. This function is only available in version 11.27/11.28+. |
| |
Reseller functions |
|
< < | Add Reseller Privileges (setupreseller) — This function allows you to confer reseller status to a user's account. |
> > | Add Reseller Privileges (setupreseller) — This function allows you to confer reseller status to a user's account. |
| | |
|
< < | Create a Reseller ACL List (saveacllist) — This function allows you to create a new ACL list to use when setting up reseller accounts. |
> > | Create a Reseller ACL List (saveacllist) — This function allows you to create a new ACL list to use when setting up reseller accounts. |
| | |
|
< < | List Current Reseller ACL Lists (listacls) — This function lists the saved reseller ACL lists on the server. |
> > | List Current Reseller ACL Lists (listacls) — This function lists the saved reseller ACL lists on the server. |
| | |
|
< < | List Reseller Accounts (listresellers) — This function lists all resellers on the server. |
> > | List Reseller Accounts (listresellers) — This function lists all resellers on the server. |
| | |
|
< < | List Reseller's Accounts' Information (resellerstats) — This function shows statistics for a specific reseller's accounts. |
> > | List Reseller's Accounts' Information (resellerstats) — This function shows statistics for a specific reseller's accounts. |
| | |
|
< < | Remove Reseller Privileges (unsetupreseller) — This function removes reseller status from a user's account. |
> > | Remove Reseller Privileges (unsetupreseller) — This function removes reseller status from a user's account. |
| | |
|
< < | Set a Reseller's ACL List (setacls) — This function specifies the ACL for a reseller, or modifies specific ACL features for a reseller. |
> > | Set a Reseller's ACL List (setacls) — This function specifies the ACL for a reseller, or modifies specific ACL features for a reseller. |
| | |
|
< < | Terminate a Reseller (terminatereseller) — This function allows you to terminate a reseller's account. |
> > | Terminate a Reseller (terminatereseller) — This function allows you to terminate a reseller's account. |
| | |
|
< < | Assign a Reseller IP Addresses (setresellerips) — This function lets you add IP addresses to a reseller's account. |
> > | Assign a Reseller IP Addresses (setresellerips) — This function lets you add IP addresses to a reseller's account. |
| | |
|
< < | Set Reseller Limits (setresellerlimits) — This function lets you set limits on the amount of bandwidth and disk space a reseller can use. |
> > | Set Reseller Limits (setresellerlimits) — This function lets you set limits on the amount of bandwidth and disk space a reseller can use. |
| | |
|
< < | Set up a Reseller's Main IP Address (setresellermainip) — This function lets you assign a main, shared IP address to a reseller's account. |
> > | Set up a Reseller's Main IP Address (setresellermainip) — This function lets you assign a main, shared IP address to a reseller's account. |
| | |
|
< < | Define a Reseller's Packages (setresellerpackagelimit) — This function allows you to control which packages resellers are able to use. It also lets you define the number of times a package can be used by a reseller. |
> > | Define a Reseller's Packages (setresellerpackagelimit) — This function allows you to control which packages resellers are able to use. It also lets you define the number of times a package can be used by a reseller. |
| | |
|
< < | Suspend a Reseller's Account (suspendreseller) — This function lets you suspend a reseller, thereby preventing the reseller from accessing his or her account. |
> > | Suspend a Reseller's Account (suspendreseller) — This function lets you suspend a reseller, thereby preventing the reseller from accessing his or her account. |
| | |
|
< < | Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. |
> > | Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. |
| | |
|
< < | View Information about Accounts Owned by a Reseller (acctcounts) — This function lists the number of accounts owned by each reseller on the server. |
> > | View Information about Accounts Owned by a Reseller (acctcounts) — This function lists the number of accounts owned by each reseller on the server. |
| | |
|
< < | Set a Reseller's Nameservers (setresellernameservers) — This function allows you to define a reseller's nameservers. |
> > | Set a Reseller's Nameservers (setresellernameservers) — This function allows you to define a reseller's nameservers. |
| |
Server information |
|
< < | Display Server Hostname (gethostname) — This function displays the server's hostname. |
> > | Display Server Hostname (gethostname) — This function displays the server's hostname. |
| | |
|
< < | Display cPanel & WHM Version (version) — This function displays the version of cPanel & WHM running on the server. |
> > | Display cPanel & WHM Version (version) — This function displays the version of cPanel & WHM running on the server. |
| | |
|
< < | Display the Server's Load Average (loadavg) — This function displays your server's load average. |
> > | Display the Server's Load Average (loadavg) — This function displays your server's load average. |
| | |
|
< < | Display the Server's Load Average (with Metadata) (systemloadavg) — This function displays your server's load average along with the call's metadata. This function is only available in version 11.27/11.28+. |
> > | Display the Server's Load Average (with Metadata) (systemloadavg) — This function displays your server's load average along with the call's metadata. This function is only available in version 11.27/11.28+. |
| | |
|
< < | View a List of Available Languages (getlanglist) — This function displays a list of the languages available on your server. |
> > | View a List of Available Languages (getlanglist) — This function displays a list of the languages available on your server. |
| |
Server administration
Note: If you wish to change the IP in a DNS zone record, you may find the swapip script more suitable than an API function. |
|
< < | Reboot the Server (reboot) — This function allows you to restart your server. |
> > | Reboot the Server (reboot) — This function allows you to restart your server. |
| | |
|
< < | Add IP Address (addip) — This function allows you to add an IP address to your server. |
> > | Add IP Address (addip) — This function allows you to add an IP address to your server. |
| | |
|
< < | Delete IP Address (delip) — This function allows you to delete an IP address from your server. |
> > | Delete IP Address (delip) — This function allows you to delete an IP address from your server. |
| | |
|
< < | List IP Addresses (listips) — This function allows you to list IP addresses associated with your server. |
> > | List IP Addresses (listips) — This function allows you to list IP addresses associated with your server. |
| | |
|
< < | Set Hostname (sethostname) — This function allows you to set the hostname for your server. Note: This name must be different from your domain name. |
> > | Set Hostname (sethostname) — This function allows you to set the hostname for your server. Note: This name must be different from your domain name. |
| | |
|
< < | Set Resolvers (setresolvers) — This function allows you to set the resolvers your server will use. |
> > | Set Resolvers (setresolvers) — This function allows you to set the resolvers your server will use. |
| | |
|
< < | Show Bandwidth (showbw) — This function will list bandwidth usage per account. |
> > | Show Bandwidth (showbw) — This function will list bandwidth usage per account. |
| | |
|
< < | Set a Non-Volatile Variable Value (nvset) — Non-volatile variables are used to save data on your server. This function allows you to set a non-volatile variable's value. |
> > | Set a Non-Volatile Variable Value (nvset) — Non-volatile variables are used to save data on your server. This function allows you to set a non-volatile variable's value. |
| | |
|
< < | Retrieve a Non-Volatile Variable Value (nvget) — This function allows you to retrieve and view a non-volatile variable's value. |
> > | Retrieve a Non-Volatile Variable Value (nvget) — This function allows you to retrieve and view a non-volatile variable's value. |
| |
Service functions |
|
< < | Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. |
> > | Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. |
| | |
|
< < | Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. |
> > | Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. |
| | |
|
< < | Configure a Service (configureservice) — This function allows you to enable or disable a service, and enable or disable monitoring of that service, as in the WHM Service Manager. |
> > | Configure a Service (configureservice) — This function allows you to enable or disable a service, and enable or disable monitoring of that service, as in the WHM Service Manager? . |
| |
SSL functions |
|
< < | Fetch SSL Certificate Information (fetchsslinfo) — This function displays an SSL certificate, CA bundle, and private key for a specified domain, or it can display a CA bundle and private key for a specified SSL certificate. |
> > | Fetch SSL Certificate Information (fetchsslinfo) — This function displays an SSL certificate, CA bundle, and private key for a specified domain, or it can display a CA bundle and private key for a specified SSL certificate. |
| | |
|
< < | Generate an SSL Certificate (generatessl) — This function generates an SSL certificate. |
> > | Generate an SSL Certificate (generatessl) — This function generates an SSL certificate. |
| | |
|
< < | Install an SSL Certificate (installssl) — This function lets you install an SSL certificate onto the server. |
> > | Install an SSL Certificate (installssl) — This function lets you install an SSL certificate onto the server. |
| | |
|
< < | List Available SSL Certificates (listcrts) — This function lists all domains on the server which have SSL certificates installed. |
> > | List Available SSL Certificates (listcrts) — This function lists all domains on the server which have SSL certificates installed. |
| |
Resources
These resources can help you interact with the XML and JSON APIs: |
|
< < | |
> > | |
| |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | | <--
- Set PAGETITLE = XML and JSON APIs
--> | |
< < | | | | | |
< < |
| META FILEATTACHMENT |
attachment="config.pl.txt" attr="h" comment="cPanel remoteaccess autosignup" date="1290390622" name="config.pl.txt" path="config.pl" size="1659" stream="config.pl" tmpFilename="/var/tmp/CGItemp7873" user="EdelSikorski" version="1" |
|
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs
Our XML API allows you to issue commands to cPanel and WHM using the XML language, while our JSON API allows you to submit requests to the system and receive a JSON response. By including these commands in your custom scripts, you can perform functions remotely, without having to access the cPanel or WHM user interface.
There are several possible applications of the XML and JSON APIs. For example, they can make managing a data center easy by allowing you to issue a single command across multiple servers. | |
> > |
For information about parsing XML output, visit our Parsing XML document. | | |
Important: The JSON API is much less resource-intensive than the XML API. We highly recommend using the JSON API, especially if performance is important, since it provides much faster results. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | | <--
- Set PAGETITLE = XML and JSON APIs
-->
\ No newline at end of file | |
> > |
| META FILEATTACHMENT |
attachment="config.pl.txt" attr="h" comment="cPanel remoteaccess autosignup" date="1290390622" name="config.pl.txt" path="config.pl" size="1659" stream="config.pl" tmpFilename="/var/tmp/CGItemp7873" user="EdelSikorski" version="1" |
|
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. | |
> > | | | | Edit a Zone Record (editzonerecord) — This function allows you to edit an existing zone record.
Get a Zone Record (getzonerecord) — This function allows you to view DNS zone records associated with a given domain. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. | |
< < | Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. This function is only available in WHM 11.25.1 and later. | > > | Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. This function is only available in version 11.27/11.28+. | | |
DNS functions | | |
Reset a DNS Zone (resetzone) — This API function will reset a DNS zone to its default values. | |
> > | Resolve an IP Address from a Domain (resolvedomainname) — This function allows you to resolve the IP address of a specified domain. This function is only available in version 11.27/11.28+.
List a Domain's MX Records (listmxs) — This function will retrieve a list of a domain's MX records. This function is only available in version 11.27/11.28+.
Create a new MX Record (savemxs) — This function allows you to create a new MX record. This function is only available in version 11.27/11.28+. | | | Package functions
Add a Package (addpkg) — This API function adds a hosting package to your server. | | |
List Packages (listpkgs) — This API function lets you view all hosting packages available to the user. | |
> > | List Available Features (getfeaturelist) — This function lists available features that you can assign to packages. This function is only available in version 11.27/11.28+. | | | Reseller functions
Add Reseller Privileges (setupreseller) — This function allows you to confer reseller status to a user's account. | | | Display cPanel and WHM Version (version) — This function displays the version of cPanel/WHM running on the server.
Display the Server's Load Average (loadavg) — This function displays your server's load average. | |
> > |
Display the Server's Load Average (systemloadavg) — This function displays your server's load average along with the call's metadata. This function is only available in version 11.27/11.28+. | | |
View a List of Available Languages (getlanglist) — This function displays a list of the languages available on your server. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. | |
< < | Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. | > > | Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. This function is only available in WHM 11.25.1 and later. | | |
DNS functions |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Important: The JSON API is much less resource-intensive than the XML API. We highly recommend using the JSON API, especially if performance is important, since it provides much faster results. | |
< < | Note: The JSON API is only available in cPanel/WHM version 11.25 and later. | | |
Formatting and using API calls | | |
JSON output format | |
< < | Note: The JSON API is only available in cPanel/WHM version 11.25 and later. | | |
Show Hide <--/twistyPlugin twikiMakeVisibleInline-->
For calls which perform an action | | |
Modify an Account (modifyacct) — Using this API function, you are able to change specific attributes of cPanel accounts, such as the theme or domain. | |
< < | Edit Quota (editquota) — This API function allows you to edit a user's disk space quota. This function is only available in WHM 11.25 and later. | > > | Edit Quota (editquota) — This API function allows you to edit a user's disk space quota. | | |
Show an Account's Information (accountsummary) — This API function will generate a list of an account's attributes, such as its IP address and partition. | | |
View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. | |
< < | Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain. This information includes whether or not CGI aliasing is enabled, log locations, and other details. This function is only available in WHM 11.25 and later. | > > | Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain. This information includes whether or not CGI aliasing is enabled, log locations, and other details. | | | | |
< < | Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. This function is only available in WHM 11.25 and later. | > > | Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. | | | | |
< < | Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. This function is only available in WHM 11.25.1 and later. | > > | Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. | | |
DNS functions | | |
Add a DNS Zone (adddns) — This API function lets you create a DNS zone. | |
< < | Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. This function is only available in WHM 11.25 and later. | > > | Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. | | | | |
< < | Edit a Zone Record (editzonerecord) — This function allows you to edit an existing zone record. This function is only available in WHM 11.25 and later. | > > | Edit a Zone Record (editzonerecord) — This function allows you to edit an existing zone record. | | | | |
< < | Get a Zone Record (getzonerecord) — This function allows you to view DNS zone records associated with a given domain. This function is only available in WHM 11.25 and later. | > > | Get a Zone Record (getzonerecord) — This function allows you to view DNS zone records associated with a given domain. | | |
Delete a DNS Zone (killdns) — This API function lets you delete a DNS zone. | | |
Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver. | |
< < | Remove a DNS Zone Record (removezonerecord) — This function allows you to remove a zone record from the server. This function is only available in WHM 11.25 and later. | > > | Remove a DNS Zone Record (removezonerecord) — This function allows you to remove a zone record from the server. | | | | |
< < | Reset a DNS Zone (resetzone) — This API function will reset a DNS zone to its default values. This function is only available in WHM 11.25 and later. | > > | Reset a DNS Zone (resetzone) — This API function will reset a DNS zone to its default values. | | |
Package functions | | |
Terminate a Reseller (terminatereseller) — This function allows you to terminate a reseller's account. | |
< < | Assign a Reseller IP Addresses (setresellerips) — This function lets you add IP addresses to a reseller's account. This function is only available in WHM 11.25 and later. | > > | Assign a Reseller IP Addresses (setresellerips) — This function lets you add IP addresses to a reseller's account. | | | | |
< < | Set Reseller Limits (setresellerlimits) — This function lets you set limits on the amount of bandwidth and disk space a reseller can use. This function is only available in WHM 11.25 and later. | > > | Set Reseller Limits (setresellerlimits) — This function lets you set limits on the amount of bandwidth and disk space a reseller can use. | | | | |
< < | Set up a Reseller's Main IP Address (setresellermainip) — This function lets you assign a main, shared IP address to a reseller's account. This function is only available in WHM 11.25 and later. | > > | Set up a Reseller's Main IP Address (setresellermainip) — This function lets you assign a main, shared IP address to a reseller's account. | | | | |
< < | Define a Reseller's Packages (setresellerpackagelimit) — This function allows you to control which packages resellers are able to use. It also lets you define the number of times a package can be used by a reseller. This function is only available in WHM 11.25 and later. | > > | Define a Reseller's Packages (setresellerpackagelimit) — This function allows you to control which packages resellers are able to use. It also lets you define the number of times a package can be used by a reseller. | | | | |
< < | Suspend a Reseller's Account (suspendreseller) — This function lets you suspend a reseller, thereby preventing the reseller from accessing his or her account. This function is only available in WHM 11.25 and later. | > > | Suspend a Reseller's Account (suspendreseller) — This function lets you suspend a reseller, thereby preventing the reseller from accessing his or her account. | | | | |
< < | Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. This function is only available in WHM 11.25 and later. | > > | Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. | | | | |
< < | View Information about Accounts Owned by a Reseller (acctcounts) — This function lists the number of accounts owned by each reseller on the server. This function is only available in WHM 11.25 and later. | > > | View Information about Accounts Owned by a Reseller (acctcounts) — This function lists the number of accounts owned by each reseller on the server. | | | | |
< < | Set a Reseller's Nameservers (setresellernameservers) — This function allows you to define a reseller's nameservers. This function is only available in WHM 11.25 and later. | > > | Set a Reseller's Nameservers (setresellernameservers) — This function allows you to define a reseller's nameservers. | | |
Server information | | |
Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. | |
< < | Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. This function is only available in WHM 11.25 and later. | > > | Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. | | | | |
< < | Configure a Service (configureservice) — This function allows you to enable or disable a service, and enable or disable monitoring of that service, as in the WHM Service Manager. This function is only available in WHM 11.25 and later. | > > | Configure a Service (configureservice) — This function allows you to enable or disable a service, and enable or disable monitoring of that service, as in the WHM Service Manager. | | |
SSL functions |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | | Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain. This information includes whether or not CGI aliasing is enabled, log locations, and other details. This function is only available in WHM 11.25 and later.
Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. This function is only available in WHM 11.25 and later. | |
> > |
Restore an Account Backup (restoreaccount) — This function allows you to restore a backup for an account. You may restore daily, weekly, or monthly backups. This function is only available in WHM 11.25.1 and later. | | |
DNS functions |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. | |
< < | Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain, including addon and subdomains, whether CGI aliasing is enabled, log locations, and other details. This function is only available in WHM 11.25 and later. | > > | Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain. This information includes whether or not CGI aliasing is enabled, log locations, and other details. This function is only available in WHM 11.25 and later. | | |
Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. This function is only available in WHM 11.25 and later. |
|
< < |
| META TOPICPARENT |
name="Trash.DeveloperResourcesWebHome" |
| > > |
| META TOPICPARENT |
name="WebHome" |
| | | XML and JSON APIs
Our XML API allows you to issue commands to cPanel and WHM using the XML language, while our JSON API allows you to submit requests to the system and receive a JSON response. By including these commands in your custom scripts, you can perform functions remotely, without having to access the cPanel or WHM user interface. |
|
< < |
| META TOPICPARENT |
name="WebHome" |
| > > |
| META TOPICPARENT |
name="Trash.DeveloperResourcesWebHome" |
| | | XML and JSON APIs
Our XML API allows you to issue commands to cPanel and WHM using the XML language, while our JSON API allows you to submit requests to the system and receive a JSON response. By including these commands in your custom scripts, you can perform functions remotely, without having to access the cPanel or WHM user interface. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Modify an Account (modifyacct) — Using this API function, you are able to change specific attributes of cPanel accounts, such as the theme or domain. | |
< < | Edit Quota (editquota) — This API function allows you to edit a user's disk space quota. | > > | Edit Quota (editquota) — This API function allows you to edit a user's disk space quota. This function is only available in WHM 11.25 and later. | | |
Show an Account's Information (accountsummary) — This API function will generate a list of an account's attributes, such as its IP address and partition. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
There are several possible applications of the XML and JSON APIs. For example, they can make managing a data center easy by allowing you to issue a single command across multiple servers. | |
> > | Important: The JSON API is much less resource-intensive than the XML API. We highly recommend using the JSON API, especially if performance is important, since it provides much faster results. | | | Note: The JSON API is only available in cPanel/WHM version 11.25 and later. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Service functions | |
< < | Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. This function is only available in WHM 11.25 and later. | > > | Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. | | | | |
< < | Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. | > > | Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. This function is only available in WHM 11.25 and later. | | |
Configure a Service (configureservice) — This function allows you to enable or disable a service, and enable or disable monitoring of that service, as in the WHM Service Manager. This function is only available in WHM 11.25 and later. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Service functions | |
< < | Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. | > > | Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. This function is only available in WHM 11.25 and later. | | |
Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | | Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver.
Remove a DNS Zone Record (removezonerecord) — This function allows you to remove a zone record from the server. This function is only available in WHM 11.25 and later. | |
> > |
Reset a DNS Zone (resetzone) — This API function will reset a DNS zone to its default values. This function is only available in WHM 11.25 and later. | | |
Package functions |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | | View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM.
Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain, including addon and subdomains, whether CGI aliasing is enabled, log locations, and other details. This function is only available in WHM 11.25 and later. | |
> > |
Change a Site's (or User's) IP Address (setsiteip) — This function allows you to change the IP address associated with a website, or a user's account, hosted on your server. This function is only available in WHM 11.25 and later. | | |
DNS functions |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Upgrade or Downgrade an Account (changepackage) — This API function allows you to change the hosting plan associated with a cPanel account. | |
< < | View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. | > > | View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM.
Obtain User Data for a Domain (domainuserdata) — This function displays information about a given domain, including addon and subdomains, whether CGI aliasing is enabled, log locations, and other details. This function is only available in WHM 11.25 and later. | | |
DNS functions | | |
List (Dump) 1 Zone (dumpzone) — This API function displays the DNS zone configuration for a specific domain. | |
< < | Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver.
| > > | Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver.
Remove a DNS Zone Record (removezonerecord) — This function allows you to remove a zone record from the server. This function is only available in WHM 11.25 and later. | | |
Package functions | | |
Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. This function is only available in WHM 11.25 and later. | |
> > | View Information about Accounts Owned by a Reseller (acctcounts) — This function lists the number of accounts owned by each reseller on the server. This function is only available in WHM 11.25 and later.
Set a Reseller's Nameservers (setresellernameservers) — This function allows you to define a reseller's nameservers. This function is only available in WHM 11.25 and later. | | | Server information
Display Server Hostname (gethostname) — This function displays the server's hostname. | | | Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server.
Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. | |
> > |
Configure a Service (configureservice) — This function allows you to enable or disable a service, and enable or disable monitoring of that service, as in the WHM Service Manager. This function is only available in WHM 11.25 and later. | | |
SSL functions |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
For calls which perform an action | |
< < | %CODE{lang="html"}% | > > | %CODE{lang="html"}%
| | | %ENDCODE%
For calls which only request data | |
< < | %CODE{lang="html"}% ("Item" is the item request, such as a package, account, etc.) | > > | %CODE{lang="html"}%
("Item" is the item request, such as a package, account, etc.)
| | | %ENDCODE%
Example
Calling this URL in WebHost Manager: /xml-api/setupreseller?user=bob&makeowner=1 will produce XML similar to: | |
< < | %CODE{lang="html"}% | > > | %CODE{lang="html"}%
| | | %ENDCODE%
<--/twistyPlugin--> | | |
Show Hide <--/twistyPlugin twikiMakeVisibleInline-->
For calls which perform an action | |
< < | %CODE{lang="javascript"}% { "result":[ { "status":1, "statusmsg":null } ] } | > > | %CODE{lang="javascript"}%
{
"result":[
{
"status":1,
"statusmsg":null
}
]
} | | | %ENDCODE%
For calls which only request data | |
< < | %CODE{lang="javascript"}% { "status":1, "statusmsg":"Ok", "acct":[ { "Item":"Parameters/Results", "Next Item":"Parameters/Results" }, { "Item":"Parameters/Results", "Next Item":"Parameters/Results" } ] } | > > | %CODE{lang="javascript"}%
{
"status":1,
"statusmsg":"Ok",
"acct":[
{
"Item":"Parameters/Results",
"Next Item":"Parameters/Results"
},
{
"Item":"Parameters/Results",
"Next Item":"Parameters/Results"
}
]
} | | | %ENDCODE%
Example
Calling this URL in WebHost Manager: /json-api/setupreseller?user=bob&makeowner=1 will produce JSON output similar to: | |
< < | %CODE{lang="javascript"}% { "result":[ { "status":1, "statusmsg":null } ] } | > > | %CODE{lang="javascript"}%
{
"result":[
{
"status":1,
"statusmsg":null
}
]
} | | | %ENDCODE%
<--/twistyPlugin--> | | |
Upgrade or Downgrade an Account ( changepackage) — This API function allows you to change the hosting plan associated with a cPanel account. | |
< < | View Current User's Privileges ( myprivs) — Using this API function, you can find out what privileges you have within WHM. | > > | View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. | | |
DNS functions | | |
List (Dump) 1 Zone ( dumpzone) — This API function displays the DNS zone configuration for a specific domain. | |
< < | Look up a Nameserver's IP Address ( lookupnsip) — This API function retrives the IP address of a registered nameserver. | > > | Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver.
| | |
Package functions | | | These resources can help you interact with the XML and JSON APIs: | |
> > |
| | | \ No newline at end of file |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
For calls which perform an action | |
< < | %CODE{lang="html"}%
| > > | %CODE{lang="html"}% | | | %ENDCODE%
For calls which only request data | |
< < | %CODE{lang="html"}%
("Item" is the item request, such as a package, account, etc.)
| > > | %CODE{lang="html"}% ("Item" is the item request, such as a package, account, etc.) | | | %ENDCODE%
Example
Calling this URL in WebHost Manager: /xml-api/setupreseller?user=bob&makeowner=1 will produce XML similar to: | |
< < | %CODE{lang="html"}%
| > > | %CODE{lang="html"}% | | | %ENDCODE%
woops, ordering error: got an ENDTWISTY before seeing a TWISTY | | |
Show Hide <--/twistyPlugin twikiMakeVisibleInline-->
For calls which perform an action | |
< < | %CODE{lang="javascript"}%
{
"result":[
{
"status":1,
"statusmsg":null
}
]
} | > > | %CODE{lang="javascript"}% { "result":[ { "status":1, "statusmsg":null } ] } | | | %ENDCODE%
For calls which only request data | |
< < | %CODE{lang="javascript"}%
{
"status":1,
"statusmsg":"Ok",
"acct":[
{
"Item":"Parameters/Results",
"Next Item":"Parameters/Results"
},
{
"Item":"Parameters/Results",
"Next Item":"Parameters/Results"
}
]
} | > > | %CODE{lang="javascript"}% { "status":1, "statusmsg":"Ok", "acct":[ { "Item":"Parameters/Results", "Next Item":"Parameters/Results" }, { "Item":"Parameters/Results", "Next Item":"Parameters/Results" } ] } | | | %ENDCODE%
Example
Calling this URL in WebHost Manager: /json-api/setupreseller?user=bob&makeowner=1 will produce JSON output similar to: | |
< < | %CODE{lang="javascript"}%
{
"result":[
{
"status":1,
"statusmsg":null
}
]
} | > > | %CODE{lang="javascript"}% { "result":[ { "status":1, "statusmsg":null } ] } | | | %ENDCODE%
<--/twistyPlugin--> | | |
Upgrade or Downgrade an Account (changepackage) — This API function allows you to change the hosting plan associated with a cPanel account. | |
< < | View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. | > > | View Current User's Privileges ( myprivs) — Using this API function, you can find out what privileges you have within WHM. | | |
DNS functions | | |
List (Dump) 1 Zone (dumpzone) — This API function displays the DNS zone configuration for a specific domain. | |
< < | Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver.
| > > | Look up a Nameserver's IP Address ( lookupnsip) — This API function retrives the IP address of a registered nameserver. | | |
Package functions | | | These resources can help you interact with the XML and JSON APIs:
\ No newline at end of file | |
> > |
- Set PAGETITLE = XML and JSON APIs
|
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. | |
< < | Service Status (restartservice) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. | > > | Service Status (servicestatus) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. | | |
SSL functions |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
There are several possible applications of the XML and JSON APIs. For example, they can make managing a data center easy by allowing you to issue a single command across multiple servers. | |
> > | Note: The JSON API is only available in cPanel/WHM version 11.25 and later. | | |
Formatting and using API calls | | | %ENDCODE%
woops, ordering error: got an ENDTWISTY before seeing a TWISTY | |
< < | JSON output format
Show Hide <--/twistyPlugin twikiMakeVisibleInline--> | > > | JSON output format
Note: The JSON API is only available in cPanel/WHM version 11.25 and later.
Show Hide <--/twistyPlugin twikiMakeVisibleInline--> | | |
For calls which perform an action
%CODE{lang="javascript"}% |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
DNS functions | |
> > | Note: If you wish to change the IP in a zone record, you may find the swapip script more suitable than an API function. | | | Add a DNS Zone (adddns) — This API function lets you create a DNS zone.
Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. This function is only available in WHM 11.25 and later. | | |
Server administration | |
> > | Note: If you wish to change the IP in a DNS zone record, you may find the swapip script more suitable than an API function. | | | Reboot the Server (reboot) — This function allows you to restart your server.
Add IP Address (addip) — This function allows you to add an IP address to your server. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Add a DNS Zone (adddns) — This API function lets you create a DNS zone. | |
< < | Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. This function is only available in WHM 11.25 and later. | > > | Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. This function is only available in WHM 11.25 and later. | | | | |
< < | Edit a Zone Record (editzonerecord) — This function allows you to edit an existing zone record. This function is only available in WHM 11.25 and later. | > > | Edit a Zone Record (editzonerecord) — This function allows you to edit an existing zone record. This function is only available in WHM 11.25 and later. | | | | |
< < | Get a Zone Record (getzonerecord) — This function allows you to view DNS zone records associated with a given domain. This function is only available in WHM 11.25 and later. | > > | Get a Zone Record (getzonerecord) — This function allows you to view DNS zone records associated with a given domain. This function is only available in WHM 11.25 and later. | | |
Delete a DNS Zone (killdns) — This API function lets you delete a DNS zone. | | |
Terminate a Reseller (terminatereseller) — This function allows you to terminate a reseller's account. | |
< < | Assign a Reseller IP Addresses (setresellerips) — This function lets you add IP addresses to a reseller's account. This function is only available in WHM 11.25 and later. | > > | Assign a Reseller IP Addresses (setresellerips) — This function lets you add IP addresses to a reseller's account. This function is only available in WHM 11.25 and later. | | | | |
< < | Set Reseller Limits (setresellerlimits) — This function lets you set limits on the amount of bandwidth and disk space a reseller can use. This function is only available in WHM 11.25 and later. | > > | Set Reseller Limits (setresellerlimits) — This function lets you set limits on the amount of bandwidth and disk space a reseller can use. This function is only available in WHM 11.25 and later. | | | | |
< < | Set up a Reseller's Main IP Address (setresellermainip) — This function lets you assign a main, shared IP address to a reseller's account. This function is only available in WHM 11.25 and later. | > > | Set up a Reseller's Main IP Address (setresellermainip) — This function lets you assign a main, shared IP address to a reseller's account. This function is only available in WHM 11.25 and later. | | | | |
< < | Define a Reseller's Packages (setresellerpackagelimit) — This function allows you to control which packages resellers are able to use. It also lets you define the number of times a package can be used by a reseller. This function is only available in WHM 11.25 and later. | > > | Define a Reseller's Packages (setresellerpackagelimit) — This function allows you to control which packages resellers are able to use. It also lets you define the number of times a package can be used by a reseller. This function is only available in WHM 11.25 and later. | | | | |
< < | Suspend a Reseller's Account (suspendreseller) — This function lets you suspend a reseller, thereby preventing the reseller from accessing his or her account. This function is only available in WHM 11.25 and later. | > > | Suspend a Reseller's Account (suspendreseller) — This function lets you suspend a reseller, thereby preventing the reseller from accessing his or her account. This function is only available in WHM 11.25 and later. | | | | |
< < | Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. This function is only available in WHM 11.25 and later. | > > | Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. This function is only available in WHM 11.25 and later. | | |
Server information
Display Server Hostname (gethostname) — This function displays the server's hostname. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
Service functions
Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. | |
> > |
Service Status (restartservice) — This function tells you which services (daemons) are enabled, installed, and monitored on your server. | | |
SSL functions |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | | List Accounts (listaccts) — This API function will generate a list of accounts associated with a server.
Modify an Account (modifyacct) — Using this API function, you are able to change specific attributes of cPanel accounts, such as the theme or domain. | |
> > |
Edit Quota (editquota) — This API function allows you to edit a user's disk space quota. | | |
Show an Account's Information (accountsummary) — This API function will generate a list of an account's attributes, such as its IP address and partition. |
| |
| META TOPICPARENT |
name="WebHome" |
XML and JSON APIs | | |
View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. | |
< < | DNS Functions | > > | DNS functions | | |
Add a DNS Zone (adddns) — This API function lets you create a DNS zone. | | |
Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver.
| |
< < | Package Functions | > > | Package functions | | | Add a Package (addpkg) — This API function adds a hosting package to your server.
Delete a Package (killpkg) — This API function deletes a hosting package from your server. | | |
List Packages (listpkgs) — This API function lets you view all hosting packages available to the user. | |
< < | Reseller Functions | > > | Reseller functions | | | Add Reseller Privileges (setupreseller) — This function allows you to confer reseller status to a user's account.
Create a Reseller ACL List (saveacllist) — This function allows you to create a new ACL list to use when setting up reseller accounts. | | |
Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. This function is only available in WHM 11.25 and later. | |
< < | Server Information | > > | Server information | | | Display Server Hostname (gethostname) — This function displays the server's hostname.
Display cPanel and WHM Version (version) — This function displays the version of cPanel/WHM running on the server. | | |
View a List of Available Languages (getlanglist) — This function displays a list of the languages available on your server. | |
< < | Server Administration | > > | Server administration | | |
Reboot the Server (reboot) — This function allows you to restart your server. | | |
Retrieve a Non-Volatile Variable Value (nvget) — This function allows you to retrieve and view a non-volatile variable's value. | |
< < | Service Functions | > > | Service functions | | | Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. | |
< < | SSL Functions | > > | SSL functions | | |
Fetch SSL Certificate Information (fetchsslinfo) — This function displays an SSL certificate, CA bundle, and private key for a specified domain, or it can display a CA bundle and private key for a specified SSL certificate. | | |
List Available SSL Certificates (listcrts) — This function lists all domains on the server which have SSL certificates installed. | |
< < | <---
Edit Web Left Bar — Leave this up temporarily for easy access.
Original Web Left Bar? — Leave this up temporarily for easy access.
ApiAuthentication ---> | | | Resources
These resources can help you interact with the XML and JSON APIs: |
| |
| META TOPICPARENT |
name="WebHome" |
| |
< < | XML API Documentation | > > | XML and JSON APIs | | | | |
< < | Resources | > > | Our XML API allows you to issue commands to cPanel and WHM using the XML language, while our JSON API allows you to submit requests to the system and receive a JSON response. By including these commands in your custom scripts, you can perform functions remotely, without having to access the cPanel or WHM user interface.
There are several possible applications of the XML and JSON APIs. For example, they can make managing a data center easy by allowing you to issue a single command across multiple servers.
Formatting and using API calls
Each XML and JSON API call is formatted as a URL. To create a function call:
- Begin with the HTTP address of your web server.
- Append a colon (:) and the appropriate port number. The port you use will vary depending on whether you wish to issue a command to WHM or cPanel.
- 2082 — cPanel (unsecured).
- 2083 — cPanel (secured).
- 2086 — WHM (unsecured).
- 2087 — WHM (secured).
- Add
/xml-api/functionname or /json-api/functionname, plus any variables required by the specific function you are calling. (For more information, see the documentation for each function, linked below.)
- For example, if your web server's hostname is
example.com, you would include one of the following strings in your script:
-
https://example.com:2087/xml-api/functionname
-
https://example.com:2087/json-api/functionname
- 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.
Examples
To use the setupreseller function on a server whose hostname is example.com, you would include a string similar to the following in your script:
- XML API:
https://example.com:2087/xml-api/setupreseller?user=bob&makeowner=1
- JSON API:
https://example.com:2087/json-api/setupreseller?user=bob&makeowner=1
Variables used in XML and JSON function calls
In addition to the input and output variables detailed here, each function call has its own distinct variables and output. For complete information about the function you wish to use, see the list of API functions below.
Input
A function call consists of the following input variables:
- name (string) — Name of the XML or JSON API call.
- ? — A question mark (?) is used to append information to the call.
- variable=value (string) — Variables and their values can then be passed to the call.
- & — An ampersand (&) is used to add variables and values to the call.
XML output format
Show Hide <--/twistyPlugin twikiMakeVisibleInline-->
The output consists of a call container, in angle brackets (<>), that contains a result container, also in angle brackets (<>). The output will appear like so:
For calls which perform an action | | | | |
< < | There are a number of resources available to help you interact with the XML API: | > > | <-- SyntaxHighlightingPlugin -->
<name_of_XMLAPI_call>
<result (status of the request) />
</name_of_XML_API_call>
<-- end SyntaxHighlightingPlugin --> | | | | |
< < | XML API Mailing List | > > | For calls which only request data | | | | |
< < | The cPanel Developer Forum | > > | <-- SyntaxHighlightingPlugin -->
<name_of_XMLAPI_call>
<item (information about the item) />
("Item" is the item request, such as a package, account, etc.)
</name_of_XML_API_call>
<-- end SyntaxHighlightingPlugin --> | | | | |
< < | XML API Fast Mode | > > | Example | | | | |
< < | Fast Mode is a new way to access the XML API functionality. This method simplifies building the request, as it no longer requires XML input. The server-side processing of Fast Mode requests is also much faster than processing XML requests. | > > | Calling this URL in WebHost Manager: /xml-api/setupreseller?user=bob&makeowner=1 will produce XML similar to: | | | | |
< < | Using Fast Mode, a request looks like this: | > > | <-- SyntaxHighlightingPlugin -->
<setupreseller>
<result status="1" statusmsg=""/>
</setupreseller>
<-- end SyntaxHighlightingPlugin -->
<--/twistyPlugin--> | | | | |
< < | /xml-api/cpanel?user=username&cpanel_xmlapi_module=StatsBar& cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=addondomains | > > | JSON output format
Show Hide <--/twistyPlugin twikiMakeVisibleInline--> | | | | |
< < | Note: When you generate the Fast Mode request, submit the entire request as a single string. For display purposes, the example above may be wrapped. | > > | For calls which perform an action
<-- SyntaxHighlightingPlugin -->
{
"result":[
{
"status":1,
"statusmsg":null
}
]
}
<-- end SyntaxHighlightingPlugin --> | | | | |
< < | XML API Functions | > > | For calls which only request data
<-- SyntaxHighlightingPlugin -->
{
"status":1,
"statusmsg":"Ok",
"acct":[
{
"Item":"Parameters/Results",
"Next Item":"Parameters/Results"
},
{
"Item":"Parameters/Results",
"Next Item":"Parameters/Results"
}
]
}
<-- end SyntaxHighlightingPlugin --> | | | | |
< < | The following links are to the documentation for WHM's XML API functions.
XML API | > > | Example
Calling this URL in WebHost Manager: /json-api/setupreseller?user=bob&makeowner=1 will produce JSON output similar to: | | | | |
< < | Using XML API Calls | > > | <-- SyntaxHighlightingPlugin -->
{
"result":[
{
"status":1,
"statusmsg":null
}
]
}
<-- end SyntaxHighlightingPlugin -->
<--/twistyPlugin--> | | | | |
< < | List Available API Calls (applist) | > > | Functions | | | | |
< < | Call cPanel API and API2 Functions (cpanel) | > > | List Available API Calls (applist) — This function lists all XML/JSON API functions available to you. | | | | |
< < | Account Functions | > > | Call the cPanel API1 and API2 commands (cpanel) — You can use the XML and JSON APIs to access cPanel API versions 1 and 2. | | | | |
< < | Create an Account (createacct) | > > | Account functions | | | | |
< < | Change an Account's Password (passwd) | > > | Create an Account (createacct) — This API function allows you to create new cPanel accounts. | | | | |
< < | Limit Bandwidth Usage (Transfer) (limitbw) | > > | Change an Account's Password (passwd) — Using this API function, you can change a cPanel account's password. | | | | |
< < | List Accounts (listaccts) | > > | Limit Bandwidth Usage (Transfer) (limitbw) — This API function allows you to change bandwidth limits for cPanel accounts. | | | | |
< < | Modify an Account (modifyacct) | > > | List Accounts (listaccts) — This API function will generate a list of accounts associated with a server. | | | | |
< < | Show an Account's Information? (accountsummary) | > > | Modify an Account (modifyacct) — Using this API function, you are able to change specific attributes of cPanel accounts, such as the theme or domain. | | | | |
< < | Suspend an Account (suspendacct) | > > | Show an Account's Information (accountsummary) — This API function will generate a list of an account's attributes, such as its IP address and partition. | | | | |
< < | Terminate an Account (removeacct) | > > | Suspend an Account (suspendacct) — Using this API function, you can prevent a user from accessing his or her cPanel account. | | | | |
< < | Unsuspend an Account (unsuspendacct) | > > | List Suspended Accounts (listsuspended) — This function allows you to view a list of suspended accounts on your server. | | | | |
< < | Upgrade or Downgrade an Account (changepackage) | > > | Terminate an Account (removeacct) — This API function allows you permanently remove an account from a server. | | | | |
< < | View Current User's Privileges (myprivs) | > > | Unsuspend an Account (unsuspendacct) — Using this API function, you can allow a user to access his or her cPanel account after it has been suspended.
Upgrade or Downgrade an Account (changepackage) — This API function allows you to change the hosting plan associated with a cPanel account.
View Current User's Privileges (myprivs) — Using this API function, you can find out what privileges you have within WHM. | | |
DNS Functions | |
< < | Only available in 11.24+ | > > | Add a DNS Zone (adddns) — This API function lets you create a DNS zone. | | | | |
< < | Add a DNS Zone (adddns) | > > | Add a Zone Record (addzonerecord) — This API function allows you to add a zone record. This function is only available in WHM 11.25 and later. | | | | |
< < | Delete a DNS Zone (killdns) | > > | Edit a Zone Record (editzonerecord) — This function allows you to edit an existing zone record. This function is only available in WHM 11.25 and later. | | | | |
< < | List All DNS Zones (listzones) | > > | Get a Zone Record (getzonerecord) — This function allows you to view DNS zone records associated with a given domain. This function is only available in WHM 11.25 and later. | | | | |
< < | List (Dump) 1 Zone (dumpzone) | > > | Delete a DNS Zone (killdns) — This API function lets you delete a DNS zone. | | | | |
< < | Lookup a Nameserver's IP Address (lookupnsip) | > > | List All DNS Zones (listzones) — This API function lists all domains and DNS zones on your server. | | | | |
< < | Package Functions | > > | List (Dump) 1 Zone (dumpzone) — This API function displays the DNS zone configuration for a specific domain. | | | | |
< < | Add a Package (addpkg) | > > | Look up a Nameserver's IP Address (lookupnsip) — This API function retrives the IP address of a registered nameserver.
Package Functions
Add a Package (addpkg) — This API function adds a hosting package to your server. | | | | |
< < | Delete a Package (killpkg) | > > | Delete a Package (killpkg) — This API function deletes a hosting package from your server. | | | | |
< < | Edit a Package (editpkg) | > > | Edit a Package (editpkg) — This function lets you edit aspects of a hosting package. | | | | |
< < | List Packages (listpkgs) | > > | List Packages (listpkgs) — This API function lets you view all hosting packages available to the user. | | |
Reseller Functions | |
> > | Add Reseller Privileges (setupreseller) — This function allows you to confer reseller status to a user's account.
Create a Reseller ACL List (saveacllist) — This function allows you to create a new ACL list to use when setting up reseller accounts.
List Current Reseller ACL Lists (listacls) — This function lists the saved reseller ACL lists on the server.
List Reseller Accounts (listresellers) — This function lists all resellers on the server.
List Reseller's Accounts' Information (resellerstats) — This function shows statistics for a specific reseller's accounts.
Remove Reseller Privileges (unsetupreseller) — This function removes reseller status from a user's account. | | | | |
< < | Add Reseller Privileges (setupreseller) | > > | Set a Reseller's ACL List (setacls) — This function specifies the ACL for a reseller, or modifies specific ACL features for a reseller. | | | | |
< < | Create a Reseller ACL List (saveacllist) | > > | Terminate a Reseller (terminatereseller) — This function allows you to terminate a reseller's account. | | | | |
< < | List Current Reseller ACL Lists (listacls) | > > | Assign a Reseller IP Addresses (setresellerips) — This function lets you add IP addresses to a reseller's account. This function is only available in WHM 11.25 and later. | | | | |
< < | List Reseller Accounts (listresellers) | > > | Set Reseller Limits (setresellerlimits) — This function lets you set limits on the amount of bandwidth and disk space a reseller can use. This function is only available in WHM 11.25 and later. | | | | |
< < | List Reseller's Accounts' Information (resellerstats) | > > | Set up a Reseller's Main IP Address (setresellermainip) — This function lets you assign a main, shared IP address to a reseller's account. This function is only available in WHM 11.25 and later. | | | | |
< < | Remove Reseller Privileges (unsetupreseller) | > > | Define a Reseller's Packages (setresellerpackagelimit) — This function allows you to control which packages resellers are able to use. It also lets you define the number of times a package can be used by a reseller. This function is only available in WHM 11.25 and later. | | | | |
< < | Set a Reseller's ACL List (setacls) | > > | Suspend a Reseller's Account (suspendreseller) — This function lets you suspend a reseller, thereby preventing the reseller from accessing his or her account. This function is only available in WHM 11.25 and later. | | | | |
< < | Terminate a Reseller (terminatereseller) | > > | Unsuspend a Reseller's Account (unsuspendreseller) — This function lets you unsuspend a reseller, thereby allowing the reseller to access his or her account. This function is only available in WHM 11.25 and later. | | |
Server Information | |
> > | Display Server Hostname (gethostname) — This function displays the server's hostname. | | | | |
< < | Display Server Hostname (gethostname) | > > | Display cPanel and WHM Version (version) — This function displays the version of cPanel/WHM running on the server. | | | | |
< < | Display cPanel and WHM Version (version) | > > | Display the Server's Load Average (loadavg) — This function displays your server's load average.
View a List of Available Languages (getlanglist) — This function displays a list of the languages available on your server. | | |
Server Administration | |
< < | Only available in versions 11.24+ | > > | Reboot the Server (reboot) — This function allows you to restart your server. | | | | |
< < | Add IP Address (addip) | > > | Add IP Address (addip) — This function allows you to add an IP address to your server. | | | | |
< < | Delete IP Address (delip) | > > | Delete IP Address (delip) — This function allows you to delete an IP address from your server. | | | | |
< < | List IP Addresses (listips) | > > | List IP Addresses (listips) — This function allows you to list IP addresses associated with your server. | | | | |
< < | Set Hostname (sethostname) | > > | Set Hostname (sethostname) — This function allows you to set the hostname for your server. Note: This name must be different from your domain name. | | | | |
< < | Set Resolvers (setresolvers) | > > | Set Resolvers (setresolvers) — This function allows you to set the resolvers your server will use. | | | | |
< < | Service Functions | > > | Show Bandwidth (showbw) — This function will list bandwidth usage per account.
Set a Non-Volatile Variable Value (nvset) — Non-volatile variables are used to save data on your server. This function allows you to set a non-volatile variable's value. | | | | |
< < | Restart Service (restartservice) | > > | Retrieve a Non-Volatile Variable Value (nvget) — This function allows you to retrieve and view a non-volatile variable's value.
Service Functions
Restart Service (restartservice) — This function lets you restart a service, or daemon, on your server. | | |
SSL Functions | |
< < | Only available in versions 11.24+ | > > | Fetch SSL Certificate Information (fetchsslinfo) — This function displays an SSL certificate, CA bundle, and private key for a specified domain, or it can display a CA bundle and private key for a specified SSL certificate. | | | | |
< < | Fetch SSL Certificate Information (fetchsslinfo) | > > | Generate an SSL Certificate (generatessl) — This function generates an SSL certificate. | | | | |
< < | Generate SSL Certificate (generatessl) | > > | Install an SSL Certificate (installssl) — This function lets you install an SSL certificate onto the server. | | | | |
< < | Install a SSL Certificate (installssl) | > > | List Available SSL Certificates (listcrts) — This function lists all domains on the server which have SSL certificates installed.
<---
Edit Web Left Bar — Leave this up temporarily for easy access.
Original Web Left Bar? — Leave this up temporarily for easy access.
ApiAuthentication --->
Resources | | | | |
< < | List Available SSL Certificates (listcrts) | > > | These resources can help you interact with the XML and JSON APIs: |
| |
| META TOPICPARENT |
name="WebHome" |
XML API Documentation | | |
Fast Mode is a new way to access the XML API functionality. This method simplifies building the request, as it no longer requires XML input. The server-side processing of Fast Mode requests is also much faster than processing XML requests. | |
< < | Using Fast Mode, a request looks like this (the actual string should not include line breaks): | > > | Using Fast Mode, a request looks like this: | | | | |
< < | /xml-api/cpanel?user=username&cpanel_xmlapi_module=StatsBar& cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=addondomains | > > | /xml-api/cpanel?user=username&cpanel_xmlapi_module=StatsBar& cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=addondomains | | |
Note: When you generate the Fast Mode request, submit the entire request as a single string. For display purposes, the example above may be wrapped. |
| |
| META TOPICPARENT |
name="WebHome" |
XML API Documentation | | |
Fast Mode is a new way to access the XML API functionality. This method simplifies building the request, as it no longer requires XML input. The server-side processing of Fast Mode requests is also much faster than processing XML requests. | |
< < | Using Fast Mode, a request looks like: /xml-api/cpanel?user=username&cpanel_xmlapi_module=StatsBar&cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=addondomains | > > | Using Fast Mode, a request looks like this (the actual string should not include line breaks):
/xml-api/cpanel?user=username&cpanel_xmlapi_module=StatsBar& cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=addondomains | | |
Note: When you generate the Fast Mode request, submit the entire request as a single string. For display purposes, the example above may be wrapped. |
| |
| META TOPICPARENT |
name="WebHome" |
XML API Documentation |
| |
| META TOPICPARENT |
name="WebHome" |
XML API Documentation | | |
XML API Fast Mode | |
< < | Fast Mode is a new way to access the XML API functionality. This method simplifies building the request, as it no longer requires XML. The server-side processing of Fast Mode requests is also much faster than processing XML requests. | > > | Fast Mode is a new way to access the XML API functionality. This method simplifies building the request, as it no longer requires XML input. The server-side processing of Fast Mode requests is also much faster than processing XML requests. | | | | |
< < | Using Fast Mode, a request looks like: /XML-api/cpanel?user=username&cpanel_xmlapi_module=StatsBar&cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=addondomains | > > | Using Fast Mode, a request looks like: /xml-api/cpanel?user=username&cpanel_xmlapi_module=StatsBar&cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=addondomains | | |
Note: When you generate the Fast Mode request, submit the entire request as a single string. For display purposes, the example above may be wrapped. |
| |
| META TOPICPARENT |
name="WebHome" |
XML API Documentation | |
> > | | | | Resources
There are a number of resources available to help you interact with the XML API: | | |
The cPanel Developer Forum | |
< < | | > > | XML API Fast Mode
Fast Mode is a new way to access the XML API functionality. This method simplifies building the request, as it no longer requires XML. The server-side processing of Fast Mode requests is also much faster than processing XML requests.
Using Fast Mode, a request looks like: /XML-api/cpanel?user=username&cpanel_xmlapi_module=StatsBar&cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=addondomains
Note: When you generate the Fast Mode request, submit the entire request as a single string. For display purposes, the example above may be wrapped. | | | XML API Functions
The following links are to the documentation for WHM's XML API functions. |
| |
| META TOPICPARENT |
name="WebHome" |
XML API Documentation
Resources |
| |
| META TOPICPARENT |
name="WebHome" |
XML API Documentation
Resources | | | View Current User's Privileges
DNS Functions | |
< < | Only available in version 11.24 or higher | | | \ No newline at end of file | |
> > | Only available in 11.24+ | | | \ No newline at end of file |
|