Querying Bandwidth Usage Statistics
Function
This API is used to query average bandwidth usage (in bit/s) for a specific time range.
URI
GET /v1/{project_id}/waf/overviews/bandwidth/timeline
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. To obtain it, go to Cloud management console and hover the cursor over your username. On the displayed window, choose My Credentials.Then, in the Projects area, view Project ID of the corresponding project. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
enterprise_project_id |
No |
String |
You can obtain the ID by calling the ListEnterpriseProject API of EPS. |
from |
Yes |
Long |
Start time (13-digit timestamp in millisecond) of the time range for which you want to query the average bandwidth usage. This parameter must be used together with to. |
to |
Yes |
Long |
End time (13-digit timestamp in millisecond) of the time range for which you want to query the average bandwidth usage. This parameter must be used together with from. |
hosts |
No |
String |
IDs of the domain names for which you want to query the bandwidth usage for a time range that is specified by from and to. In the cloud mode, domain name IDs can be obtained by calling the ListHost API. In the dedicated mode, domain name IDs can be obtained by calling the ListPremiumHost API. |
instances |
No |
String |
IDs of dedicated WAF instances. This parameter is used to query the average bandwidth usage of domain names protected by those dedicated WAF instances for a time range that is specified by from and to. |
group_by |
No |
String |
How data is displayed. For example, if the value is DAY, data is displayed by the day. If this parameter is not specified, the data is displayed by the minute. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
Content-Type |
Yes |
String |
Content type Default: application/json;charset=utf8 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
[items] |
Array of BandwidthStatisticsTimelineItem objects |
Bandwidth statistics over the time, including BANDWIDTH, IN_BANDWIDTH, and OUT_BANDWIDTH. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Key value. The options are BANDWIDTH, IN_BANDWIDTH, and OUT_BANDWIDTH. |
timeline |
Array of TimeLineItem objects |
Statistics of the corresponding key value over time. This parameter includes the time field for the time point and the num field for statistics between the previous time point and the time point specified by the time field. |
Parameter |
Type |
Description |
---|---|---|
time |
Long |
Time point |
num |
Integer |
Statistics for the time range from the previous time point to the point specified by the time field. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code |
error_msg |
String |
Error message |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code |
error_msg |
String |
Error message |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code |
error_msg |
String |
Error message |
Example Requests
The following example shows how to query the bandwidth usage. The project ID is specified by project_id and the time is from 2022-04-21 00:00:00 to 2022-04-21 14:35:36.
GET https://{Endpoint}/v1/{project_id}/waf/overviews/bandwidth/timeline?enterprise_project_id=0&from=1650470400196&to=1650522936196
Example Responses
Status code: 200
ok
[ { "key" : "IN_BANDWIDTH", "timeline" : [ { "time" : 1650470400000, "num" : 0 } ] }, { "key" : "OUT_BANDWIDTH", "timeline" : [ { "time" : 1650470400000, "num" : 0 } ] }, { "key" : "BANDWIDTH", "timeline" : [ { "time" : 1650470400000, "num" : 0 } ] } ]
Status Codes
Status Code |
Description |
---|---|
200 |
ok |
400 |
Request failed. |
401 |
The token does not have required permissions. |
500 |
Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.