Updated on 2024-05-16 GMT+08:00

Querying Statistics About Domain Names

Function

  • You can query data within the past 90 days.
  • The time span of data queried cannot exceed 7 days.
  • You can specify up to 100 domain names at a query.
  • The start time and end time must be both specified.
  • The start time and end time must be timestamps in milliseconds. Only exact 5-minute intervals are allowed, for example, 0 minutes, 5 minutes, 10 minutes, and 15 minutes. If the values are not exact 5-minute intervals, the returned data may not be the expected data.
  • If the start time is 2019-01-24 20:15:00, the statistics in [20:15:00, 20:20:00) are collected.
  • Unit: byte for traffic-related metrics, bit/s for bandwidth-related metrics, and number of times for request quantity. You can query statistics about specific domain names and details about specific metrics.
  • If multiple domain names are passed, the data of each domain name is returned separately.
  • You can query up to 10 metrics each time.

URI

GET /v1.0/cdn/statistics/domain-item-details

Table 1 Query parameters

Parameter

Mandatory

Type

Description

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.

start_time

Yes

Long

Query start time (timestamp). Only exact 5-minute intervals are allowed.

end_time

Yes

Long

Query end time (timestamp). Only exact 5-minute intervals are allowed.

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

Possible values are mainland_china and outside_mainland_china. The default value is mainland_china.

stat_type

Yes

String

Network resource consumption statistics

  • bw (bandwidth)
  • flux (traffic)
  • bs_bw (retrieval bandwidth)
  • bs_flux (retrieval traffic)

Access statistics

  • req_num (number of requests)
  • hit_num (number of hits)
  • bs_num (number of content retrieval requests)
  • bs_fail_num (number of failed content retrieval requests)
  • hit_flux (traffic generated by requests that hit the caches)

HTTP status code statistics (one or more types can be returned)

  • http_code_2xx (status codes 2xx)
  • http_code_3xx (status codes 3xx)
  • http_code_4xx (status codes 4xx)
  • http_code_5xx (status codes 5xx)
  • bs_http_code_2xx (origin status codes 2xx)
  • bs_http_code_3xx (origin status codes 3xx)
  • bs_http_code_4xx (origin status codes 4xx)
  • bs_http_code_5xx (origin status codes 5xx)
  • status_code_2xx (details of status code 2xx)
  • status_code_3xx (details of status code 3xx)
  • status_code_4xx (details of status code 4xx)
  • status_code_5xx (details of status code 5xx)
  • bs_status_code_2xx (details of origin status code 2xx)
  • bs_status_code_3xx (details of origin status code 3xx)
  • bs_status_code_4xx (details of origin status code 4xx)
  • bs_status_code_5xx (details of origin status code 5xx)
  • status_code and bs_status_code statistics cannot be queried at the same time. Otherwise, statistics will be inaccurate. You cannot query status_code statistics by region.

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameter

Parameter

Type

Description

domain_item_details

DomainItemDetail object

Domain name details.

Table 4 DomainItemDetail

Parameter

Type

Description

start_time

Long

Time when data collection starts (timestamp). The time may be different from the request time.

end_time

Long

Time when data collection ends (timestamp). The time may be different from the request time.

stat_type

String

Metric type.

domains

Array of Map<String,Object> objects

Metric data. If there is no data in the query time segment, an empty array [] is returned.

Example Request

GET https://cdn.myhuaweicloud.com/v1.0/cdn/statistics/domain-item-details?start_time=1515996000000&end_time=1515999600000&domain_name=www.test1.com,www.test2.com&stat_type=flux

Example Response

Status code: 200

OK

{
  "domain_item_details" : {
    "start_time" : 1515996000000,
    "end_time" : 1515999600000,
    "stat_type" : "flux",
    "domains" : [ {
      "domain_name" : "www.test1.com",
      "flux" : [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]
    }, {
      "domain_name" : "www.test2.com",
      "flux" : [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]
    } ]
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.