Statistical Interface (new version)
Interface
This interface is used to query the statistical metric information of the user or domain name.
Method | Path | Description |
---|---|---|
POST | /v2/stat/query | The path of all statistical data. Different statistical indexes are specified by the metric in the post parameter. |
Default interface request frequency limit: 30 times/sec.
Default Request Body
All metric-supported parameters can be expanded by this method.
Parameters | Optional | Type | Description |
---|---|---|---|
metric | Required | String | Specify avg_speed, avg_speed_region, pv, pv_region, etc. |
endTime | Optional | Timestamp | The end value of the time range, which is the current time by default. The time span is up to 90 days in UTC time. |
startTime | Optional | Timestamp | The start value of the time range to query, which is 24 hours before endTime in UTC time by default. |
period | Optional | Long | Granularity of query results (second). The optional value is 60, 300, 3600, and 86400. The default value is 300, and the UV default value is 3,600. When the time granularity of 60s is selected, it is recommended to select the interval span of startTime and endTime as 0.5 – 1h. Otherwise, it cannot be normally returned due to a large amount of data. |
key_type | Optional | Long | Identify the key content. 0=>Domain name, 1=> User ID, and 2=> Tag. It is 0 by default. |
key | Optional | list<String> | Domain name or user ID or tag |
groupBy | Optional | String | The return result aggregation granularity. In the case of key =>, aggregate the results according to the key, and in the case of empty =>, return the overall result. |
Response Body
The response results of all metrics are expanded by this method.
Parameters | Type | Description |
---|---|---|
status | String | It is "Ok" when it returns a result normally. |
details | list<Details> | List type |
count | Long | List length |
Details content
Parameters | Type | Description |
---|---|---|
timestamp | Timestamp | Time stamp which is a UTC time. |
key | String | Aggregation granularity (groupBy): key => key, other => total. |
... | Object | Extension field, the statistical index corresponding to the metric. |
Average Rate Related Interfaces
Query the Average Rate.
metric:avg_speed
Extension Field of the Response Body:
Parameters | Type | Description |
---|---|---|
avgspeed | Long | The average rate in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"avg_speed","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","avgspeed": 1219463},
{"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","avgspeed": 1289562}
],
"count": 2
}
Average Rate for the Client Access Distribution Query
metric:avg_speed_region
Request body extension field:
Parameters | Optional | Type | Description |
---|---|---|---|
prov | Optional | String | The province queried and typed in Chinese pinyin, which is empty by default. Query the national data. |
isp | Optional | String | The ISP code you want to query. It is empty by default, and it is used to query all operator data. |
Extension field of the response body:
Parameters | Type | Description |
---|---|---|
distribution | list<DistributionData> | Client access distribution data |
DistributionData content
Parameters | Type | Description |
---|---|---|
location | String | The province and region where the client resides. |
isp | String | Operator to which the client belongs |
avgspeed | Long | The average rate in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"avg_speed_region","startTime":"2019-03-19T06:00:00Z","endTime":"2019-03-19T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","prov":"beijing","isp":"ct"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"timestamp": "2019-03-19T06:00:00Z","key": "cdaa.wonter.net","distribution": [{"location": "Beijing","isp": "Telecom","avgspeed": 1683448}]},
{"timestamp": "2019-03-19T06:05:00Z","key": "cdaa.wonter.net","distribution": [{"location": "Beijing","isp": "Telecom","avgspeed": 1964874}]}
],
"count": 2
}
pv/qps Related Interface
pv/qps Query
metric: pv
Request body extension field:
Parameters | Optional | Type | Description |
---|---|---|---|
level | Optional | String | Query the edge node or center node pv. You can fill in "all" or "edge" or "internal", and the default is "all" |
Extension Field of the rResponse Body:
Parameters | Type | Description |
---|---|---|
pv | Long | The number of requests during the statistical period |
qps | Long | Average qps in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"pv","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","level":"all"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"pv": 2145,"qps": 7,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
{"pv": 2950,"qps": 9,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
],
"count": 2
}
pv/qps Https Protocol Query
metric: pv_protocol
Request Body Extension Field:
Parameters | Optional | Type | Description |
---|---|---|---|
protocol | Optional | String | Query all PVs. You can fill in "https" or "http" or "all", and the default is "all" |
Extension Field of the Response Body:
Parameters | Type | Description |
---|---|---|
pv | Long | The number of requests during the statistical period |
qps | Long | Average qps in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"pv","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","protocol":"https"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"pv": 2145,"qps": 7,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
{"pv": 2950,"qps": 9,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
],
"count": 2
}
Origin PV/QPS Query
metric: pv_src
Extension field of the response body:
Parameters | Type | Description |
---|---|---|
pv | Long | The number of back-to-origin requests in the statistical period |
qps | Long | Average qps in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"pv_src","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"pv": 0,"qps": 0,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
{"pv": 0,"qps": 0,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
],
"count": 2
}
Query pv/qps (Sub-client Access Distribution)
metric: pv_region
Request Body Extension Field:
Parameters | Optional | Type | Description |
---|---|---|---|
prov | Optional | String | The province queried and typed in Chinese pinyin, which is empty by default. Query the national data. |
isp | Optional | String | The ISP code you want to query. It is empty by default, and it is used to query all operator data. |
Extension Field of the Response Body:
Parameters | Type | Description |
---|---|---|
distribution | list<DistributionData> | Client access to the distributed data |
DistributionData content
Parameters | Type | Description |
---|---|---|
location | String | The province and region where the client resides. |
isp | String | Operator to which the client belongs |
pv | Long | The number of requests during the statistical period |
qps | Long | Average qps in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"pv_region","startTime":"2019-03-19T06:00:00Z","endTime":"2019-03-19T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","prov":"beijing","isp":"ct"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"timestamp": "2019-03-19T06:00:00Z","key": "cdaa.wonter.net","distribution": [{"location": "Beijing","isp": "Telecom","pv": 148,"qps": 0}]},
{"timestamp": "2019-03-19T06:05:00Z","key": "cdaa.wonter.net","distribution": [{"location": "Beijing","isp": "Telecom","pv": 142,"qps": 0}]}
],
"count": 2
}
uv Query
metric:uv
Extension Field of the Response Body:
Parameters | Type | Description |
---|---|---|
uv | Long | The number of requests during the statistical period |
Request example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"uv","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"uv": 127994,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
{"uv": 12700,"timestamp": "2019-03-20T06:05:00Z",key": "cdaa.wonter.net"}
],
"count": 2
}
Traffic Bandwidth Interface
Query Traffic and Bandwidth
metric: flow
Request Body Extension Field:
Parameters | Optional | Type | Description |
---|---|---|---|
level | Optional | String | Query the bandwidth of the edge node or center node. You can fill in "all" or "edge" or "internal", and the default is "all" |
Extension Field of the Response Body:
Parameters | Type | Description |
---|---|---|
flow | Long | Number of bytes transmitted in the statistical period |
bps | Long | Average bps in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"flow","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","level":"all"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"flow": 88186275,"bps": 2351634,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
{"flow": 90383520,"bps": 2410227,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
],
"count": 2
}
Query Traffic and Bandwidth (Sub-protocol)
metric: flow_protocol
Request Body Extension Field:
Parameters | Optional | Type | Description |
---|---|---|---|
protocol | Optional | String | Query the traffic and bandwidth of http or https. The value is {'http','https','all'}, and the default is ‘all’. |
Response Body Extension Field:
Parameters | Type | Description |
---|---|---|
flow | Long | Number of bytes transmitted in the statistical period |
bps | Long | Average bps in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"flow_protocol","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","protocol":"all"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"flow": 88186275,"bps": 2351634,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
{"flow": 90383520,"bps": 2410227,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
],
"count": 2
}
Query the Flow Rate and Bandwidth (Sub-client Access Distribution)
metric: flow_region
Request body extension field:
Parameters | Optional | Type | Description |
---|---|---|---|
prov | Optional | String | The province queried and typed in Chinese pinyin, which is empty by default. Query the national data. |
isp | Optional | String | The ISP code you want to query. It is empty by default, it is used to query all operator data. |
Response Body Extension Field:
Parameters | Type | Description |
---|---|---|
distribution | list<DistributionData> | Client access distribution data |
DistributionData content
Parameters | Type | Description |
---|---|---|
location | String | The province and region where the client resides. |
isp | String | Operator to which the client belongs |
flow | Long | Number of bytes transmitted in the statistical period |
bps | Long | Average bps in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"flow_region","startTime":"2019-03-19T06:00:00Z","endTime":"2019-03-19T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","prov":"beijing","isp":"ct"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"timestamp": "2019-03-19T06:00:00Z","key": "cdaa.wonter.net","distribution": [{"location": "Beijing","isp": "Telecom","flow": 918742,"bps": 24499}]},
{"timestamp": "2019-03-19T06:05:00Z","key": "cdaa.wonter.net","distribution": [{"location": "Beijing","isp": "Telecom","flow": 881491,"bps": 23506}]}
],
"count": 2
}
Query Monthly Peak 95 Bandwidth
method | path | Description |
---|---|---|
POST | /v2/billing | Open query statistics interface |
Query Parameters
Parameters | Optional | Type | Description |
---|---|---|---|
domains | Optional | string | The domain names or labels separated by ','. |
type | Required | string | The value is peak95, and the table queries the monthly peak95 bandwidth data. |
withTag | Optional | bool | Indicates whether the query object is tag or domain. It is queried by domain by default. When the parameter value is true, it indicates that it is queried by tag. |
byTime | Optional | bool | Indicates whether to query by month。 The default is to query by month. When the parameter value is true, the table is queried by the input time。 |
billingMonth | Optional | string | The starting month for the monthly query is expressed in the format of "year-month". The default value is the current month. |
startTime | Optional | string | The start time (UTC). The default value is 24 hours before the current time. |
endTime | Optional | string | The end time (UTC). The default value is the current time. |
Return Parameter
Parameters | Optional | Type | Description |
---|---|---|---|
billing_details | Required | billing_detail | Query data |
Description of billing_detail type
Parameters | Optional | Type | Description |
---|---|---|---|
bill_band | Required | int | 95 bandwidth value |
bill_time | Required | string | The time of the data point |
Request Example
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 19 Dec 2019 04:26:40 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.1.5
x-bce-request-id: aca2dd9e-77a6-7de8-b9d9-7561fb330ba5
{
"type": "peak95",
"byTime": false, // When byTime is false, startTime and endTime parameters are invalid
"startTime": "2019-12-17T16:00:00Z",
"endTime": "2019-12-18T06:53:33Z",
"billingMonth": "2018-11"
}
Return Example
{
"billing_details": {
"bill_band": 14536504775,
"bill_time": "2018-11-17T12:20:00Z"
}
}
Query Origin Traffic and Origin Bandwidth
metric: src_flow
Extension field of the response body:
Parameters | Type | Description |
---|---|---|
flow | Long | Number of bytes transmitted in the statistical period |
bps | Long | Average bps in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"src_flow","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"flow": 0,"bps": 0,"timestamp": "2019-03-20T06:00:00Z"},
{"flow": 0,"bps": 0,"timestamp": "2019-03-20T06:05:00Z"}
],
"count": 2
}
Hit Rate Interface
Byte Hit Rate Query
metric: real_hit
Response Body Extension Field:
Parameters | Type | Description |
---|---|---|
hitrate | Double | Byte hit rate in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"real_hit","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","hitrate": 1},
{"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","hitrate": 1}
],
"count": 2
}
Request Hit Rate Query
metric: pv_hit
Extension field of the response body:
Parameters | Type | Description |
---|---|---|
hitrate | Double | The pv hit rate in the statistical period |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"pv_hit","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","hitrate": 1},
{"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","hitrate": 1}
],
"count": 2
}
Status Code Interface
Statistical Query of Status Code
metric: httpcode
Request Body Extension Field:
| Parameters | Optional | Type | Description | | ----- | --- | ------ | -------------------------------------------------- | | level | Optional | String | Support the status code query of edge nodes. You can fill in "all" or "edge", the default is "all" |
Response Body Extension field:
Parameters | Type | Description |
---|---|---|
counters | list<KvCounter> | Number of HTTP status codes |
KvCounter content
Parameters | Type | Description |
---|---|---|
name | Long | HTTP status code |
count | Long | Statistics count |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"httpcode","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"counters": [{"name": 200,"count": 14205},{"name": 499,"count": 27}],"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
{"counters": [{"name": 200,"count": 14558}],"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
],
"count": 2
}
Origin status code
metric: src_httpcode
Response Body Extension Field:
Parameters | Type | Description |
---|---|---|
counters | list<KvCounter> | Number of HTTP status codes |
KvCounter content
Parameters | Type | Description |
---|---|---|
name | Long | HTTP status code |
count | Long | Statistics count |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"src_httpcode","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"counters": [{"name": 200,"count": 14205},{"name": 499,"count": 27}],"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
{"counters": [{"name": 200,"count": 14558}],"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
],
"count": 2
}
Status Code Statistics Query (sub-client access distribution)
metric:httpcode_region
Request Body Extension Field:
Parameters | Optional | Type | Description |
---|---|---|---|
prov | Optional | String | The province queried and typed in Chinese pinyin, which is empty by default. Query the national data. |
isp | Optional | String | The ISP code you want to query. It is empty by default, and it is used to query all operator data. |
Response body Extension field:
Parameters | Type | Description |
---|---|---|
distribution | list<HttpCodeDistributionData> | Data details by client access region distribution |
HttpCodeDistributionData content
Parameters | Type | Description |
---|---|---|
location | String | The province and region where the client resides. |
isp | String | Operator to which the client belongs |
counters | list<KvCounter> | Number of HTTP status codes |
KvCounter content
Parameters | Type | Description |
---|---|---|
name | Long | HTTP status code |
count | Long | Statistics count |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"httpcode_region","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","prov":"beijing","isp":"ct"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","distribution": [{"location": "Beijing","isp": "Telecom","counters": [{"name": 200,"count": 137}]}]},
{"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","distribution": [{"location": "Beijing","isp": "Telecom","counters": [{"name": 200,"count": 141}]}]}
],
"count": 2
}
TopN Query Interface
TopN urls
top urls sorted by pv
metric: top_urls
Request body extension field:
Parameters | Optional | Type | Description |
---|---|---|---|
extra | Optional | Long | Query the record of the specified HTTP status code. The default value is as follows: "" |
Extension field of the response body:
Parameters | Type | Description |
---|---|---|
counters | list<TopNCounter> | Top100 Count |
total_pv | Long | Total pv |
total_flow | Long | Total flow |
TopNCounter
Parameters | Type | Description |
---|---|---|
name | String | url |
pv | Long | pv |
flow | Long | flow |
filesize | Long | File size and unit byte |
filetype | String | File type url resources suffix |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"top_urls","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","extra":200}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{
"timestamp": "2019-03-20T06:00:00Z",
"key": "cdaa.wonter.net",
"counters": [
{"name": "https://cdaa.wonter.net/htpoty.gif","flow": 901459555.7,"pv": 145364, "filetype":"gif", "filesize":3},
{"name": "http://cdaa.wonter.net/htpoty.gif","flow": 391129.2,"pv": 63, "filetype":"gif", "filesize":3}
],
"total_pv": XX,
"total_flow": XX
}
],
"count": 1
}
TopN Referers
metric: top_referers
Description: top referers sorted by pv
Request body extension field:
Parameters | Optional | Type | Description |
---|---|---|---|
extra | Optional | Long | Query the record of the specified HTTP status code. The default value is as follows: "" |
Response Body Extension Field:
Parameters | Type | Description |
---|---|---|
counters | list<TopNCounter> | Top100 Count |
total_pv | Long | Total pv |
total_flow | Long | Total flow |
TopNCounter
Parameters | Type | Description |
---|---|---|
name | String | refer |
pv | Long | pv |
flow | Long | flow |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"top_referers","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","extra":200}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{
"timestamp": "2019-03-20T06:00:00Z",
"key": "cdaa.wonter.net",
"counters": [
{"name": "https://www.baidu.com/s","flow": 541193408.8,"pv": 87177},
{"name": "https://www.baidu.com/","flow": 240400970.7,"pv": 38723}
],
"total_pv": XX,
"total_flow": XX
}
],
"count": 1
}
TopN domains
metric: top_domains
Description: Top domains sorted by pv
Request body extension field:
Parameters | Optional | Type | Description |
---|---|---|---|
extra | Optional | Long | Query the record of the specified HTTP status code. The default value is as follows: "" |
Response Body Extension field
Parameters | Type | Description |
---|---|---|
counters | list<TopNCounter | Top100 Count |
total_pv | Long | Total pv |
total_flow | Long | Total flow |
TopNCounter
Parameters | Type | Description |
---|---|---|
name | String | domains |
pv | Long | pv |
flow | Long | flow |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"top_domains","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","extra":200}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{
"timestamp": "2019-03-20T06:00:00Z",
"key": "cdaa.wonter.net",
"counters": [
{"name": "cdaa.wonter.net","flow": 901860646.5,"pv": 145276}
],
"total_pv": 145276,
"total_flow": 901860646.5
}
],
"count": 1
}
TopN clientIP
metric:top_clientip
Description: The top clientip sorted by pv.
Request Body Extension Field:
Parameters | Optional | Type | Description |
---|---|---|---|
extra | Optional | Long | Query the record of the specified HTTP status code. The default value is as follows: "" |
Response Body Extension Field
Parameters | Type | Description |
---|---|---|
counters | list<TopNCounter> | Top100 Count |
total_pv | Long | Total pv |
total_flow | Long | Total flow |
TopNCounter
Parameters | Type | Description |
---|---|---|
name | String | ip |
pv | Long | pv |
flow | Long | flow |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"top_clientip","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","extra":200}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{
"timestamp": "2019-03-20T06:00:00Z",
"key": "cdaa.wonter.net",
"counters": [
{"name": "219.239.227.181","flow": 901860646.5,"pv": 145276}
],
"total_pv": 145276,
"total_flow": 901860646.5
}
],
"count": 1
}
Query IPV6 HTTP and HTTPS Independent Data Interfaces
method | path | Description |
---|---|---|
post | /v2/stat/ipv6?stat_type=http/https/all | Query IPv6 HTTP, HTTPS, independent data, and data type queried by stat_type table. When the value is HTTP, it is the HTTP data queried by the table. When the value is HTTPS, it is the HTTPS data queried by the table. When the value is all, it is the total data queried by the table and containing HTTP and HTTPS. Query all by default |
Request Body
Parameters | Optional | Type | Description |
---|---|---|---|
startTime | Optional | Timestamp | The start value of the time range to query, which is 24 hours before endTime in UTC time by default. |
endTime | Optional | Timestamp | The end value of the time range, which is the current time by default. The time span is up to 90 days in UTC time. |
period | Optional | unsigned int | Query time granularity (s), whose default value is 300s. |
keys | Optional | list |
List of domain names queried. When this list is empty, query the data of all domain names of this user. |
Response Body
Parameters | Optional | Type | Description |
---|---|---|---|
details | Required | map<timesmap:map<domain:Data>> | Query results, where the timestamp? is the time in UTC format and the domain is the domain name or userId. The data is the data of a domain name/user at a certain time point. |
count | Required | unsigned int | Number of data entries queried |
Description of Data Type
Parameters | Optional | Type | Description |
---|---|---|---|
flow | Required | unsigned int | Flow data queried |
bps | Required | unsigned int | Bandwidth data queried |
pv | Required | unsigned int | pv data queried |
code | Required | list<map<xxx:unsigned int> | Code data queried |
Request Example
POST /v2/stat/ipv6?stat_type=all
Host: cdn.baidubce.com
{
"startTime": "2020-12-21T06:25:00Z",
"endTime": "2020-12-21T07:25:00Z",
"period": 3600,
"keys": [
"aod-image.baidu.com"
]
}
Response Example
{
"count": 3,
"details": {
"2020-12-21T06:00:00Z": {
"aod-image.baidu.com": {
"flow": 822846778444,
"bps": 1828548396,
"pv": 5953881,
"code": {
"200": 5718978,
"206": 4888,
"304": 230015,
"400": 37,
"403": 77,
"404": 64,
"408": 19,
"499": 15810
}
}
},
"2020-12-21T07:00:00Z": {
"aod-image.baidu.com": {
"flow": 794698943871,
"bps": 1765997653,
"pv": 5995772,
"code": {
"200": 5733844,
"206": 4908,
"304": 257020,
"400": 32,
"403": 57,
"404": 42,
"408": 17,
"499": 16057
}
}
},
"2020-12-21T08:00:00Z": {
"aod-image.baidu.com": {
"flow": 767797627279,
"bps": 1706216949,
"pv": 6043410,
"code": {
"200": 5790261,
"206": 4893,
"304": 248256,
"400": 31,
"403": 81,
"404": 32,
"408": 15,
"416": 1,
"499": 15975
}
}
}
}
}
CDN Error Code Classification Statistics Query
metric: error
Response Body Extension Field:
Parameters | Type | Description |
---|---|---|
counters | list<KvCounter> | Error status code type and corresponding count |
KvCounter content
Parameters | Type | Description |
---|---|---|
code | String | Error Code |
counters | list<DetailData> | Error type and number |
DetailData content
Parameters | Type | Description |
---|---|---|
name | String | Error Type |
count | Long | Statistics count |
Request Example
POST /v2/stat/query HTTP/1.1
Host: cdn.baidubce.com
{"metric":"error","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}
Return Example
HTTP/1.1 200 OK
Content-Length: 190
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN
{
"status": "ok",
"details": [
{"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","counters": [{"code": 499,"counters": [{"name": "Unknown","count": 27}]}]},
{"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","counters": [{"code": 499,"counters": [{"name": "Unknown","count": 18}]}]}
],
"count": 2
}
Classification of Error Type
Name | Remarks |
---|---|
Source site error | 4xx and 5xx |
Origin server error, CDN cached | 4xx和5xx |
CDN error | 4xx and 5xx |
Missed 499 | 499 |
Hit 499 | 499 |
Reading timeout when CDN connects to the origin server. | 5xx |
CDN fails to connect the origin server. | 5xx |
CDN fails to connect the origin server (SSL). | 5xx |
CDN fails to parse the origin server domain name. | 5xx |
CDN fails to interact with the origin server | 5xx |
unknown | Unmatched error type |