Child pages
  • cPanel API 1 Functions - Bandwidth::displaybw
Skip to end of metadata
Go to start of metadata

 

Description

This function generates bandwidth data for the specified day.

Warning:

We removed this function in cPanel & WHM version 11.52. We strongly recommend that you use the following UAPI function instead of this function:

  • UAPIBandwidth::query — This function queries an account's bandwidth data and returns a report.

Examples 


 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$bandwidth_data = $cpanel->api1('Bandwidth', 'displaybw', array('example.com', 'example.com', 'jan', '2014', 'subdomain.example.com') ); // Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $bandwidth_data = $cpliveapi->api1('Bandwidth', 'displaybw', ['example.com', 'example.com', 'jan', '2014', 'subdomain.example.com'] ); # Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Tag System (deprecated)


Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We provide this example to help developers move from the old cPanel tag system to our LiveAPI system. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

<cpanel Module="Bandwidth::displaybw( $FORM('domain','target','month','year','subd') )">
 Command Line
cpapi1 --user=username Bandwidth displaybw example.com example.com jan 2014 subdomain.example.com


Notes:

  • You must URI-encode these values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to cPanel API 1 documentation or run the cpapi1 --help command. 

 Output (HTML)
<td align="center" class="bwtdh1">
<b>1</b>
</td>
<td class="bwtd1">91</td>
<td class="bwtd1">1.65</td>
<td class="bwtd1">0.00</td>
<td class="bwtd1">0.00</td>
<td class="bwtd1">0.00</td>
<td class="bwtd1">6.26</td>
</tr>

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain name.

Any valid domain.example.com
targetstring

Required

The domain name.

The domain return's value.

Important:

This value must match the domain value. 

example.com
tmonthstring

Required

The month for which to retrieve bandwidth data.

The first three letters of a month's name, in English.jan
tyearinteger

Required

The year for which to retrieve bandwidth data.

The four digits for the desired year.2014
subdstring

The subdomain for which to retrieve bandwidth data.

If you do not use this parameter, the function returns bandwidth data for all of the specified domain's subdomains.

Any subdomain on the specified domain.subdomain.example.com
timezonestring

The timezone in which to report the data.

This parameter defaults to the domain's timezone.

A timezone in Olson tz format.America/Chicago

Returns

This function returns HTML to display a table row of bandwidth data for the specified account. The table row includes one column of bandwidth data for each day of the specified month.