Help Center/ Content Delivery Network/ API Reference/ Out-of-Date APIs/ Statistics Analysis/ Querying Peak Bandwidth Data of a Domain Name
Updated on 2024-09-02 GMT+08:00

Querying Peak Bandwidth Data of a Domain Name

Function

  • This API is used to query peak bandwidth data of a domain name.
  • You can query data within the past 90 days.
  • The query time span cannot exceed 31 days.
  • If the start time is 2022-10-24 00:00:00 and end time is 2022-10-25 00:00:00, the statistics in [2022-10-24 00:00:00, 2022-10-25 00:00:00) are queried.
  • The start time and end time must be timestamps in milliseconds. They must be both specified.
  • Unit: byte for traffic-related metrics, bit/s for bandwidth-related metrics and peak bandwidth-related metrics, and number of times for request quantity and status code-related metrics. You can query statistics about specific domain names and details about specific metrics.
  • A single tenant can call this API twice per second.

URI

GET /v1.0/cdn/statistics/bandwidth-calc

Table 1 Query parameters

Parameter

Mandatory

Type

Description

start_time

Yes

Long

  • Start timestamp of the query. The timestamp must be set to a multiple of 5 minutes.
  • If the value of interval is 300, set start_time to a multiple of 5 minutes, for example, 1631240100000 (2021-09-10 10:15:00).
  • If interval is set to 3600, set start_time to the top of an hour, for example, 1631239200000 (2021-09-10 10:00:00).
  • If interval is set to 86400, set start_time to 00:00:00 GMT+08:00, for example, 1631203200000 (2021-09-10 00:00:00).

end_time

Yes

Long

  • End timestamp of the query. The timestamp must be set to a multiple of 5 minutes.
  • If the value of interval is 300, set end_time to a multiple of 5 minutes, for example, 1631243700000 (2021-09-10 11:15:00).
  • If interval is set to 3600, set end_time to the top of an hour, for example, 1631325600000 (2021-09-11 10:00:00).
  • If interval is set to 86400, set end_time to 00:00:00 GMT+08:00, for example, 1631376000000 (2021-09-12 00:00:00).

domain_name

Yes

String

Domain name list. Domain names are separated by commas (,), for example, www.test1.com,www.test2.com. The value all indicates that all domain names under your account are queried.

service_area

No

String

Service region. The value can be mainland_china (default) or outside_mainland_china. This parameter is invalid for querying origin pull metrics.

enterprise_project_id

No

String

Enterprise project that the resource belongs to. This parameter is valid only when the enterprise project function is enabled. The value all indicates all projects. This parameter is mandatory when you use an IAM user to call this API.

calc_type

Yes

String

Query type. Currently, bw_95 (95th percentile bandwidth), bw_peak (average daily peak bandwidth), and bw_95_average (average daily 95th percentile bandwidth) are supported.

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameter

Parameter

Type

Description

bandwidth_calc

Map<String,Object>

95th percentile bandwidth and average daily peak bandwidth information.

Status code: 400

Table 3 Response body parameter

Parameter

Type

Description

error

ErrMsg object

Error code and error message.

Table 4 ErrMsg

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

GET https://cdn.myhuaweicloud.com/v1.0/cdn/statistics/bandwidth_calc?start_time=1667030400000&end_time_1667116800000&domain_name=www.test1.com&service_area=mainland_china&enterprise_project_id=all&calc_type=bw_peak

Example Response

{
  "bandwidth_calc": [
    {
      "value": 10000000,
      "calc_type": "bw_peak"
    },
    {
      "value": 20000000,
      "calc_type": "bw_peak"
    }
  ]
}

Status Codes

Status Code

Description

200

Success response.

400

Error response.

Error Codes

See Error Codes.