Query Statistics Metrics for Domain Name

Last updated: 2019-11-29 17:59:35

API Description

This API (GetDsaHostStatistics) is used to query statistical metrics for log access in a specific period of time, allowing you to get statistics on log access.
Domain name: dsa.api.qcloud.com


  • A maximum of 100 calls to this API are allowed per minute. Do not call the API frequently.
  • More than one item or domain name can be queried at a time, and a summary of the usage data is displayed by domain name.

Description of statistical metrics

| Statistical Metric | Metric Name | Metric Description |
| ------- | ------ |
| Total traffic | flux | Calculates the total traffic in the query period by domain name (in byte) |
| Peak bandwidth | bandwidth | Calculates the peak bandwidth in the query period by domain name (in bps) |
| Total requests | request | Calculates the total number of requests in the query period by domain name |
| Average access latency | delay | Calculates the average access latency in the query period by domain name (in ms) |

Request Parameters

The following request parameter list only provides API request parameters. Common request parameters are required when the API is called. The Action field for this API is GetDsaHostStatistics.

| Parameter | Required | Type | Example | Description |
| ------ | ----------| ----------| ------- |
| metrics | Yes | String | flux | Statistical metric name. For more information, please see Description of statistical metrics |
| projects | No | Unsigned | [1001853] | Lists project IDs, View project Ids
Submitted in JSON format |
| hosts | No | String | test.qcloud.com | Lists domain names, used to query data by domain name
Domain names are submitted in JSON format |
| startDate | No | String | 2018-04-19 | Start time
Format: YY-MM-DD |
| endDate| No | String | 2018-04-20 | End time,
format: YY-MM-DD |
| offset | No | Unsigned | 15 | Queries the number of offsets |
| length | No | Unsigned | 10 | Length of this query |

Parameter description:

  • When the start time or the end time is empty, the statistics on the day of the query are returned by default.
  • By default, combined statistics of all domain names are queried by account when no query object is specified.
  • To prevent the URL length from exceeding the limit due to an overlong query parameter when more than one project or domain name is queried, you are recommended to submit your requests using the POST method.
  • When there are a large number of accounts under an account, you can use "offset" and "length" to set fragmented queries. The queried domain names are displayed in a descending order from the first metric specified in "metrics".

Response Parameters

Parameter Type Description
code Int Common error code
0: Successful
Other values: Failed
For more information, please see Common Error Codes on the Error Codes page
message String Module error message description depending on API
codeDesc String Error message or error code at business side
data Array Details on the queried data. For more information, please see data Field Description

data Field Description

Parameter Name Type Description
host String Domain name
For example: dsatest.qcloud.com
flux Unsigned Total traffic
bandwidth Unsigned Peak bandwidth
request Unsigned Total number of requests
delay Unsigned Average access latency

Sample Code

Configuration example

Queries the statistics on traffic, bandwidth, and number of requests of all domain names under an account on 2018-04-17.

GET Request

For a GET request, all the parameters are required to be appended to the URL:


To prevent the URL length from exceeding the limit due to an overlong query parameter, this API is called to submit query requests using the POST method by default.

POST Request

For a POST request, the parameters are input in HTTP Request-body. The request address is:


Formats such as form-data and x-www-form-urlencoded are supported for the parameters. The array of parameters is as follows:

array (
  'Action' => 'GetDsaStatistics',
  'SecretId' => 'SecretId',
  'Timestamp' => 1524279600,
  'Nonce' => 123456789,
  'Signature' => 'Signature',
  'metrics' => '["flux","bandwidth","request"]',
  'startDate' => "2018-04-17"
  'endData' => "2018-04-17"

Example of returned result

Query Successful

    "code": 0,
    "message": "",
    "codeDesc": "Success",
    "data": {
            "host": "a.dsa.qcloud.com",
            "bandwidth": 589746515,
            "host": "b.dsa.qcloud.com",
            "bandwidth": 749516585,

Query Failed

    "code": 4100,
    "message": "Authentication failed. For more information, please see the Authentication section in the document.",
    "codeDesc": "AuthFailure"