All Documents
Current Document

Content is empty

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

Documentation

GetServerData

Last updated:2021-07-20 11:46:10

GetServerData

Description

  • You can call this operation to obtain the service and back-to-origin statistics for specified domain names based on the specified time granularity. The time granularity can be 1 minute, 5 minutes, 1 hour, or 1 day. You can obtain the statistics for the following metrics: flow (traffic in bytes), bandwidth (bandwidth in bit/s), request (number of requests), and qps (average number of requests per second).
  • If you specify a granularity of 1 hour or 1 day, the peak bandwidth collected in the five-minute periods contained in the granularity is used.
  • Organization method: The data is organized by server IP address.
  • You can query data within the past year. The start time and the end time cannot be more than 90 days apart. The allowed maximum time period varies with the time granularity.
  • You can specify the domain names (with the CdnType and Domains parameters), areas, protocol type, IP address type, and time granularity to query data.
  • 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/GetServerData, 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:10+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:15+0800.
Metric No String The metrics to query. Valid values: flow (traffic in bytes), bandwidth (bandwidth in bit/s), request (number of requests), and qps (average number of requests per second). Separate multiple metrics with commas (,). By default, all metrics are queried.
DataType No String The type of the data. Valid values: edge (service data) and origin (back-to-origin data). You can specify only one type at a time.
Interval No Long The time granularity of the statistics data. Valid values: 1 (one minute), 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. When the granularity is 1 minute, the start time and the end time cannot be more than 24 hours apart. When the granularity is 5 minutes, the start time and the end time cannot be more than 31 days apart. For other granularities, the start time and the end time cannot be more than 90 days apart.
CdnType Yes String The business type. You can specify only one type at a time. Valid values: file, video, page, and download.
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.
Regions No String The regions. For more information, see Usage notes. Separate multiple regions with commas (,). By default, all regions are queried.
Schema No String The protocol type. Valid values: http, http, and quic. You can specify only one type at a time. By default, all types are queried.
ResultType No String Specifies whether to expand the statistics data and, if yes, in which dimensions. Valid values: unexpand, expand (expand in all dimensions), region (expand by region), domain (expand by domain name), and schema (expand by protocol type). Default value: unexpand.

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.
Metric String The metrics that are queried.
DataType String The type of the data.
Interval Long The time granularity.
CdnType String The business type.
Domains String The domain names, separated with commas (,).
Regions String The regions, separated with commas (,).
Schema String The protocol type.
ResultType String Indicates whether the statistics data is expanded and, if yes, in which dimensions. Multiple dimensions are separated with commas (,).
RequestId String The ID of the request. A unique request ID is returned for each request. The request ID is required for troubleshooting.
Datas Datas[] The statistics data.

Datas

Parameter Type Description
Condition Condition[] The query conditions.
Data Data[] The queried data.

Condition

Parameter Type Description
Domains String The domain names, separated with commas (,).
DataType String The type of the data. Valid values: edge (service data) and origin (back-to-origin data).
Regions String The regions, separated with commas (,).
Schema String The protocol type. The value is not displayed if this condition was not specified.

Data

Parameter Type Description
Time String The time point.
Bandwidth Long The peak service or back-to-origin bandwidth at the specified time point. The value is not displayed if this condition was not specified.
Flow Long The service or back-to-origin traffic at the specified time. The value is not displayed if this condition was not specified.
Request Long The number of service or back-to-origin requests at the specified time point. The value is not displayed if this condition was not specified.
Qps Long The service or back-to-origin QPS at the specified time point. The value is not displayed if this condition was not specified.

Examples

Sample request

GET method:

GET /2020-06-30/statistics/GetServerData?StartTime=2020-09-01T08%3a00%2b0800&EndTime=2020-09-01T08%3a05%2b0800&Metric=flow&DataType=edge&Interval=5&CdnType=video&Regions=CN&Schema=&ResultType=
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: GetServerData
x-version: 2020-06-30

POST method:

POST /2020-06-30/statistics/GetServerData
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: GetServerData
x-version: 2020-06-30
Content-Type: application/json
{
    "StartTime":"2020-09-01T08:00+0800",
    "EndTime":"2020-09-01T08:05+0800",
    "Metric":"flow",
    "DataType": "edge",
    "Interval": 5,
    "CdnType": "video",
    "Regions": "CN",
    "Schema": "",
    "ResultType": ""
}

Sample response

{
    "StartTime": "2020-09-01T08:00+0800",
    "EndTime": "2020-09-01T08:05+0800",
    "Metric": "flow",
    "DataType": "edge",
    "Interval": 5,
    "CdnType": "video",
    "Domains": "www.test.com",
    "Regions": "CN",
    "Schema": "http,https,quic",
    "ResultType": "unexpand",
    "Datas": [
        {
            "Condition": {
                "DataType": "edge"
            },
            "Data": [
                {
                    "Time": "2020-09-01T08:00+0800",
                    "Flow": 286003.30000000005
                }
            ]
        }
    ],
    "RequestId": "f5d2fe42-57d1-4934-bc8d-511ef6780f71"
}
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback