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

List Reseller's Accounts' Information — resellerstats

This function shows account statistics for a specific reseller's accounts.

Calling Functions

Using the XML API

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

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

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

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

  • 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 resellerstats function takes the following required variable as input:
  • reseller — Name of the reseller whose account information you wish to see.

Output

  • resellerstats — Root-level XML tag for the output of the resellerstats function.
    • result — Container for the results.
      • accts — Container for the account information.
        • bandwidthlimit — The account's bandwidth limit.
        • bandwidthused — Amount of bandwidth used by the account this month.
        • deleted — Whether or not the account has been deleted.
          • 1 — yes.
          • 0 — no.
        • diskquota — The account's disk space limit.
        • diskused — Disk space used by the account.
        • domain — Main domain name associated with the account.
        • package — Package used by the account.
        • user — Username associated with the account.
      • bandwidthlimit — The reseller's total bandwidth limit.
      • diskquota — The reseller's total disk space usage limit.
      • diskused — Total disk space used by accounts owned by the reseller account.
        • If the reseller account is owned by root, then the reseller account will not be added to the total sum.
      • reseller — Name of the reseller.
      • status (boolean) — Whether or not the operation succeeded.
        • 1 — yes.
        • 0 — no.
      • statusmsg (string) — Message about the result of the resellerstats operation.
      • totalbwalloc — Total bandwidth allocated to accounts by the reseller.
      • totalbwused — Total bandwidth used by the reseller's accounts this month.
      • totaldiskalloc — Total disk space allocated to accounts by the reseller.
      • bwoverselling — Boolean value indicating whether bandwidth overselling is permited.
        • 1 — yes.
        • 0 — no.
      • diskoverselling — Boolean value indicating whether disk overselling is permited.
        • 1 — yes.
        • 0 — no.

Examples

XML API

Calling https://example.com:2087/xml-api/resellerstats?reseller=bob in WebHost Manager will produce output similar to:

<resellerstats>
   <result>
      <accts> 
         <bandwidthlimit>0.00</bandwidthlimit>
         <bandwidthused>0.00</bandwidthused>        
         <deleted>1</deleted>        
         <diskquota>0.00</diskquota>        
         <diskused>0.00</diskused>        
         <domain>somedomain.tld</domain>        
         <package>deleted account</package>        
          <suspended>1</suspended>
         <user>user</user>        
     </accts>
     <accts>
         <bandwidthlimit>1000.00</bandwidthlimit>
         <bandwidthused>256.31</bandwidthused>        
         <deleted>0</deleted>        
         <diskquota>1000.00</diskquota>        
         <diskused>500.21</diskused>        
         <domain>otherdomain.tld</domain>        
         <package>gold</package>        
          <suspended>0</suspended>
         <user>somed</user>        
     </accts>        
     <diskused>516.6</diskused>        
     <reseller>bob</reseller>        
     <status>1</status>        
     <statusmsg>Fetched Reseller Data OK</statusmsg>        
     <totalbwalloc>3200</totalbwalloc>
     <totalbwused>1007.07</totalbwused>        
     <totaldiskalloc>1800</totaldiskalloc>        
   </result>
</resellerstats>

JSON API

Calling the URL https://example.com:2087/json-api/resellerstats?reseller=bob in WebHost Manager will produce output similar to:

{
   "result":{
      "reseller":"john",
      "totalbwalloc":0,
      "status":1,
      "totaldiskalloc":0,
      "totalbwused":0,
      "statusmsg":"Fetched Reseller Data OK",
      "accts":[
         {
            "diskquota":0,
            "bandwidthused":0,
            "suspended":0,
            "user":"cpanel1",
            "deleted":0,
            "bandwidthlimit":0,
            "domain":"cpanelrocks.net",
            "package":"Limit One",
            "diskused":19.33
         }
      ],
      "diskused":19.33
   }
}

Topic revision: r9 - 21 Nov 2012 - 14:36:40 - Main.LaurenceSimon