- Created by Documentation, last modified on Apr 09, 2018
Description
This function retrieves account bandwidth information.
Examples
https://hostname.example.com:2087/cpsess##########/json-api/showbw?user=username
https://hostname.example.com:2087/cpsess##########/xml-api/showbw?user=username
whmapi0 showbw user=username
Notes:
- You must URI-encode values.
- For more information and additional output options, read our Guide to WHM API 0 documentation or run the
whmapi0 --help
command. - We introduced this functionality in cPanel & WHM version 11.52.0.8.
{ "bandwidth":[ { "reseller":"root", "month":6, "acct":[ { "reseller":0, "bwusage":[ ], "deleted":0, "limit":"0", "owner":"root", "user":"example", "maindomain":"example.com", "totalbytes":0 }, { "reseller":"1", "bwusage":[ ], "deleted":0, "limit":"0", "owner":"dominic", "user":"dominic", "maindomain":"domain.com", "totalbytes":0 }, { "reseller":"1", "bwusage":[ ], "deleted":0, "limit":"5242880", "owner":"root", "user":"mary", "maindomain":"example2.com", "totalbytes":0 } ], "totalused":"352", "year":2009 } ] }
<showbw> <bandwidth> <acct> <deleted>0</deleted> <limit>0</limit> <maindomain>example.com</maindomain> <owner>root</owner> <reseller>0</reseller> <totalbytes>0</totalbytes> <user>example</user> </acct> <acct> <deleted>0</deleted> <limit>0</limit> <maindomain>domain.com</maindomain> <owner>dominic</owner> <reseller>1</reseller> <totalbytes>0</totalbytes> <user>dominic</user> </acct> <acct> <deleted>0</deleted> <limit>5242880</limit> <maindomain>example2.com</maindomain> <owner>root</owner> <reseller>1</reseller> <totalbytes>0</totalbytes> <user>mary</user> </acct> <month>6</month> <reseller>root</reseller> <totalused>352</totalused> <year>2009</year> </bandwidth> </showbw>
Parameters
Parameter | Type | Description | Possible values | Example |
---|---|---|---|---|
user | string | An account's username, to only query that account. If you do not use this parameter, the function queries all users. | A valid username on the server. | username |
month | integer | The month to query. This parameter defaults to the current month. |
| 12 |
year | string | The year to query. This parameter defaults to the current year. | A four-digit year. | 2014 |
showres | string | The reseller, to only query that reseller. If you do not use this parameter, the function queries all users. | A valid reseller username on the server. | reseller_user |
search | string | A Perl Compatible Regular Expression (PCRE) that filters the results. The system matches the PCRE against the If you do not specify a value for both the | A valid PCRE. | username
|
searchtype | string | The account information to query. If you do not specify a value for both the |
| domain |
Returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
bandwidth | array of hashes | An array of hashes of an account's bandwidth information | This hash includes the reseller and month returns and the acct array of hashes. | |
| string | The reseller username. |
|
|
month | integer | The month. | The | 12 |
acct | array of hashes | An array of hashes of bandwidth information for the reseller's accounts. | Each hash includes the reseller , deleted , limit , owner , user , maindomain , and totalbytes returns and the bwusage array.. | |
| Boolean | Whether the user is a reseller. The function returns this value in the |
| 0 |
| array | An array of bandwidth information. The function returns this array in the | One or more strings of bandwidth information. | |
| Boolean | Whether the account was deleted. The function returns this value in the |
| 0 |
| integer | The account's bandwidth limit. The function returns this value in the | An integer that represents a bandwidth quota, in bytes. | 0 |
| string | The account's owner. The function returns this value in the |
| root |
| string | The account username. The function returns this value in the | A valid cPanel or WHM username. | user |
| string | The account's main domain. The function returns this value in the | A valid domain on the server. | example.com |
| integer | The account's total bandwidth usage during the queried period. The function returns this value in the | An integer that represents the bandwidth usage, in bytes. | 352 |
Function information
API Version:
WHM API 1 Equivalent:
Important:
We strongly recommend that you use WHM API 1. WHM API 0 is deprecated.
Available in:
WHM 11+
Methods:
GET, POST
Required Parameters:
(none)
Return Formats:
About WHM API 0
Warning:
WHM API 0 is deprecated. We strongly recommend that you use the equivalent WHM API 1 function instead.
Notes:
- Some functions and parameters may require that you authenticate as the
root
user. - You must use the appropriate WHM ports (
2086
or2087
) to call WHM API functions.
Find a function
Related functions
-
Page:WHM API 0 Functions - accountsummary — This function retrieves a user's account summary.
-
Page:WHM API 0 Functions - myprivs — This function retrieves the current user's WHM privileges.
-
Page:WHM API 0 Functions - gethostname — This function retrieves the server's hostname.
-
Page:WHM API 0 Functions - createacct — This function creates a cPanel account.
-
Page:WHM API 0 Functions - domainuserdata — This function retrieves domain data.