All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

GetDomainUsageData

Last updated:2021-07-20 11:45:43

GetDomainUsageData

Description

You can call this operation to obtain the usage data in specified areas for specified domain names or a specified business type in a specified time period. The usage data includes the traffic in bytes, bandwidth in bit/s, and the number of requests (including dynamic HTTP requests, static HTTPS requests, dynamic HTTPS requests, static QUIC requests, and dynamic QUIC requests).

  • You can specify a start time and end time to query data. You must specify both the start time and the end time.
  • You can specify multiple domain names at a time. By default, all domain names of the current account are queried.
  • You can query data within the past year. The start time and the end time cannot be more than 31 days apart.
  • You can specify a time granularity, including 5 minutes, 1 hour, and 1 day. The default granularity is 5 minutes.
  • Timeliness: You can query only data that was generated 5 minutes before.
  • A single query can include up to 1,000 domain names and return up to 10,000 data points. The time period of a single query must contain at least one time granularity. For example, if you select the time granularity of 5 minutes, the start time and the end time must be at least 5 minutes apart.

Request syntax

The API request contains the specified directory /2020-06-30/statistics/GetDomainUsageData, common request headers, and operation-specific request parameters. For more information, see the sample request.

Request parameters

Parameter Required Type Description
StartTime Yes String The beginning of the time range to query. Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm+0800 format. The time must be in UTC+8. Example: 2016-08-01T21:14+0800.
EndTime Yes String The end of the time range to query. Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm+0800 format. The time must be in UTC+8. The end time must be later than the start time. Example: 2016-08-01T21:14+0800.
Metric Yes String The metric to query. You can specify only one metric at a time. Valid values: traffic, bandwidth, static-https (number of static HTTPS requests), dynamic-http (number of dynamic HTTP requests), dynamic-https (number of dynamic HTTPS requests), static-quic (number of static QUIC requests), and dynamic-quic (number of dynamic QUIC requests). The Areas parameter takes effect only when the Metric parameter is set to bandwidth or traffic.
CdnType Yes String The business type. You can specify only one type at a time. Valid values: file, video, and page.
Domains No String The domain names to query. Separate multiple domain names with commas (,). By default, all domain names of the current account that are online in the specified time period are queried. When both the CdnType and Domains parameters are specified, a strong check is performed.
Areas No String The name of the area. For more information, see Usage notes. The Areas parameter takes effect only when the Metric parameter is set to bandwidth or traffic. In this case, you can specify only one area at a time, and the default value is CN. When the Metric parameter is set to static-https, dynamic-http, dynamic-https, static-quic, or dynamic-quic, this parameter does not take effect, and the statistics of all areas are returned.
Interval No Long The time granularity of the statistics data. Valid values: 5 (five minutes), 60 (one hour), and 1440 (one day). For granularities that are greater than or equal to 5 minutes, the peak bandwidth collected in the five-minute periods contained in the granularity is used. The default granularity is 5 minutes. You can query data within the past year. The start time and the end time cannot be more than 31 days apart.

Response parameters

Parameter Type Description
StartTime String The beginning of the time range that is queried.
EndTime String The end of the time range that is queried.
CdnType String The business type.
Domains String The domain names, separated with commas (,).
Areas String The area.
Interval Long The time granularity.
Metric Metric[] The metric that is queried.
RequestId String The ID of the request.
PeakTime String The time when the bandwidth peaked. This parameter is returned only when the Metric parameter is set to bandwidth.

Metric

Parameter Type Description
Time String The time point. The value is the time when the bandwidth peaked when the Metric parameter is set to bandwidth.
Value Long The metric value. Unit: bytes, bit/s, or count.

Examples

Sample request

GET method:

GET /2020-06-30/statistics/GetDomainUsageData?StartTime=2020-09-01T08%3a00%2b0800&EndTime=2020-09-01T08%3a05%2b0800&Metric=bandwidth&CdnType=video
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: GetDomainUsageData
x-version: 2020-06-30

POST method:

POST /2020-06-30/statistics/GetDomainUsageData
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: GetDomainUsageData
x-version: 2020-06-30
Content-Type: application/json
{
    "StartTime":"2020-09-01T08:00+0800",
    "EndTime":"2020-09-01T08:05+0800",
    "Metric":"bandwidth",
    "CdnType":"video"
}

Sample response

On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback