Updated on 2024-09-02 GMT+08:00

Querying Consumption Details

You can query data within the past 90 days.

The time span ranges from 1 hour to 31 days.

You can specify up to 100 domain names at a query.

The start time and end time must be specified at the same time. Their values must be precise down to the millisecond. If the sampling interval is less than or equal to 1 hour, the time granularity must be one hour, for example, 2020-07-01 08:00:00 and 2020-07-01 09:00:00. If the sampling interval is longer than 1 hour, the time granularity must be a whole day, for example, 2020-07-01 00:00:00 and 2020-07-02 00:00:00.

If the start time and end time do not meet the requirements, the returned data may be different from what was expected.

Function

This API is used to query consumption details about specific domain names within a time range.

URI

GET /v1.0/cdn/statistics/domain-summary-detail

Request

Request parameters

Table 1 describes the request parameters.

Table 1 Request parameters

Parameter

Mandatory

Type

Description

start_time

No

Long

Query start timestamp, in milliseconds.

end_time

No

Long

Query end timestamp, in milliseconds.

domain_name

Yes

String

Domain name list. Use commas (,) to separate domain names, for example, www.test1.com,www.test2.com. The value ALL indicates that all domain names under a tenant are queried. A maximum of 100 domain names can be queried at a time.

interval

No

Integer

Sampling interval, in seconds.

For a time span of 1 day, the sampling intervals can be 5 minutes, 1 hour, 4 hours, and 8 hours. That is to say, the values can be 300, 3600, 14400, and 28800.

For a time span of 2 to 7 days, the sampling intervals can be 5 minutes, 1 hour, 4 hours, 8 hours, and 1 day. That is to say, the values can be 300, 3600, 14400, 28800, and 86400.

For a time span of 8 to 31 days, the sampling intervals can be 4 hours, 8 hours, and 1 day. That is to say, the values can be 14400, 28800, and 86400.

If this parameter is not passed, the system uses the smallest value corresponding to the queried time span by default.

stat_type

Yes

String

Types of statistics: bw (bandwidth), flux (traffic), bs_bw (origin pull bandwidth), bs_flux (origin pull traffic), bs_num (total number of origin pulls), bs_fail_num (total number of failed origin pulls), req_num (total number of requests), req_hit_rate (cache hit ratio), flux_hit_rate (traffic hit ratio), bs_fail_rate (origin pull failure rate), qps (requests per second), http_code_2xx (status code 2xx), http_code_3xx (status code 3xx), http_code_4xx (status code 4xx), and http_code_5xx (status code 5xx).

service_area

No

String

Valid values are mainland_china and outside_mainland_china. The default value is mainland_china. You cannot query origin pull metrics including bs_flux, bs_bw, and bs_fail_rate by service area.

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.

Example request

Requested path

GET https://cdn.myhuaweicloud.com/v1.0/cdn/statistics/domain-summary-detail?start_time=1498838400000&end_time=1502380500000&domain_name=www.example.com&interval=300&stat_type=bs_flux&enterprise_project_id=0

Response

Response parameters

Table 2 describes the response parameter.

Table 2 Response parameter

Parameter

Type

Description

domain_summary_detail

Object

Detailed data. For details, see Table 3.

domain_summary_detail parameter description

Table 3 describes the parameters.

Table 3 domain_summary_detail parameter description

Parameter

Type

Description

start_time

Integer

Query start timestamp, in milliseconds.

end_time

Integer

Query end timestamp, in milliseconds.

interval

Integer

Sampling interval, in seconds.

values

Array of integers

Array of sampling points. Each sampling point is generated at every sampling interval. The type of each sampling point is long. The traffic unit is byte. The bandwidth unit is bit/s.

stat_type

String

Statistics type.

service_area

String

Possible values are mainland_china (Chinese mainland) and outside_mainland_china (outside the Chinese mainland). You cannot query origin pull metrics by service area.

Example response
{
  "domain_summary_detail": {
        "interval": 300,
        "values": [835038583,835038584],
        "start_time": 1498838400000,
        "end_time": 1502380500000,
        "stat_type": "bs_flux",
        "service_area": "outside_example_china"
   }
}

Status Codes

See Status Codes.

Error Codes

See Error Codes.