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

View Information about Accounts Owned by a Reseller — acctcounts

This function lists the total number of accounts owned by a reseller, as well as how many suspended accounts the reseller owns, and what the reseller's account creation limit is, if any.

If no reseller is specified, counts will be provided for the reseller who is currently logged in.

note Note: Counts for other users will only be provided if the user issuing the function call has root-level permissions or owns the provided account.

Calling Functions

Using the XML API

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

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

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

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

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

  • user (string) — Username of the reseller whose account counts you wish to view.
    • Example: joe

PICK Remember: If this variable is not included, the system will return counts for the reseller who is currently logged in.

Output

  • acctcounts — Root-level XML tag for the output of the acctcounts function.
    • reseller — Container for the reseller's information.
      • account (string) — The reseller's username.
      • active (string) — The number of active accounts owned by the reseller.
      • limit (string) — The limit, if any, on the number of accounts the reseller can create.
      • suspended (string) — The number of suspended accounts owned by the reseller.
    • result — Container for the information about the acctcounts function call.
      • status (boolean) — Whether the call was successful.
        • 1 — success.
        • 0 — failure.
      • statusmsg (string) — Status or error message about the acctcounts function call.

Examples

XML API

Calling the following function in WebHost Manager:

https://example.com:2087/xml-api/acctcounts?user=joe

will produce output similar to:

<acctcounts>
     <reseller>
          <account>joe</account>
          <active>4</active>
          <limit/>
          <suspended>0</suspended>
     </reseller>
     <result>
          <status>1</status>
          <statusmsg>Obtained reseller account counts.</statusmsg>
     </result>
</acctcounts>

JSON API

Calling the following function in WebHost Manager:

https://example.com:2087/json-api/acctcounts?user=joe

will produce output similar to:

{
   "reseller":{
      "suspended":1,
      "account":"joe",
      "active":3,
      "limit":""
   },
   "result":[
      {
         "status":1,
         "statusmsg":"Obtained reseller account counts."
      }
   ]
}

Topic revision: r2 - 29 Sep 2009 - 18:11:56 - MelanieSeibert