Baidu AI Cloud
中国站

百度智能云

CDN

Statistical Interface (old version)

Interface Description

Query of various statistical indicators.

/v2/stat/[metric] Default interface request frequency limit: 30 times/sec.

pv/qps Query Interface

Method Path Description
GET /v2/stat/pv Query domain name pv requests

URL parameters:

Parameter Optional Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas. If not specified, it returns the sum of pv number of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 90 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
period Optional Int Granularity of the queried result, in seconds, you can select 300, 3,600 and 86,400, and the default is 300.
withRegion Optional Bool Query access distribution details at clients. When this item is included, the number of details in the result cannot exceed 64.
prov Optional String Full spell of the province queried, and it is empty by default. Query national data. It cannot be used with withRegion at the same time.
isp Optional String ISP code to be queried, it is empty by default. Query all operator data. It cannot be used with withRegion at the same time.

Response body

Parameter Type Description
details list type, see the PvDetails content in the following table. Data details

PvDetails content:

Parameter Type Description
timestamp Timestamp Time point, UTC time
pv Int Number of requests in the statistical period
qps Int Average qps in the statistical period
regions list type, see the PvRegionData content in the following table. Distribution data of client accesses, include this item when the request contains the withRegion parameter.

PvRegionData content:

Parameter Type Description
location String Province and region where the client is located
isp String Client affiliated to ISP
pv Int Number of requests in the statistical period
qps Int Average qps in the statistical period

Request example

GET /v2/stat/pv?domain=my.test.com&endTime=2016-10-13T02%3A00%3A00Z&period=3600&startTime=2016-10-13T00%3A00%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

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 

{ 
  "details": 
  [ 
    {"timestamp":"2016-10-13T00:00:00Z","pv":1998202,"qps":556}, 
    {"timestamp":"2016-10-13T01:00:00Z","pv":2169932,"qps":603} 
  ] 
} 

Bandwidth & Traffic Query Interface

Method Path Description
GET /v2/stat/flow Query domain name traffic records

URL parameters:

Parameter Optional Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas, and it returns the sum of data of all domain names. If not specified, it returns the sum of traffic of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 31 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
period Optional Int Granularity of the query result, in seconds, you can select 300, 3,600 and 86,400, and the default is 300.
withRegion Optional Bool Query access distribution details at clients. When this item is included, the number of details in the result cannot exceed 64.
prov Optional String Full spell of the province queried, and it is empty by default. Query national data. It cannot be used with withRegion at the same time.
isp Optional String ISP code to be queried, it is empty by default. Query all operator data. It cannot be used with withRegion at the same time.
level Optional String Query the bandwidth of the edge node or central node. Shouldn’t be used together with withRegion, you can fill “edge” or “internal”.

Response body

Parameter Type Description
details For list, please see in the following table. Data details

FlowDetail Content:

Parameter Type Description
timestamp Timestamp Time point, UTC time
flow Int Number of transmitted bytes in the statistical period
bps Int Average bps in the statistical period
regions For list, please see in the following table. Distribution data of client accesses, include this item when withRegion in the request is true.

FlowRegionData content:

Parameter Type Description
location String Province and region where the client is located
isp String Client affiliated to ISP
flow Int Number of transmitted bytes in the statistical period
bps Int Average bps in the statistical period

Request example

GET /v2/stat/flow?domain=my.test.com&endTime=2016-10-13T02%3A00%3A00Z&period=3600&startTime=2016-10-13T00%3A00%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

Response 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 

{ 
  "details": 
  [ 
    {"timestamp":"2016-10-13T00:00:00Z","flow":42652354694,"bps":94783010}, 
    {"timestamp":"2016-10-13T01:00:00Z","flow":45766298297,"bps":101702885} 
  ] 
} 

Origin Traffic Query Interface

Method Path Description
GET /v2/stat/srcflow Query domain name origin traffic records

URL parameters:

Parameter Optional Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas. If not specified, it returns the sum of traffic of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 31 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
period Optional Int Granularity of the query result, in seconds, you can select 300, 3,600 and 86,400, and the default is 300.

Response body

Parameter Type Description
details For list, please see in the following table. Data details

Request example

GET /v2/stat/srcflow?domain=my.test.com&endTime=2016-10-13T02%3A00%3A00Z&period=3600&startTime=2016-10-13T00%3A00%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

Response 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 
{ 
  "details": 
  [ 
    {"timestamp":"2016-10-13T00:00:00Z","flow":741119469,"bps":1646932}, 
    {"timestamp":"2016-10-13T01:00:00Z","flow":905548590,"bps":2012330} 
  ] 
} 

Byte Hit Rate Query Interface

Method Path Description
GET /v2/stat/hitrate Query byte hit rate

URL parameters:

Parameter Whether to be selectable Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas. If not specified, it returns the average of byte hit rates of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 31 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
granularity Optional Int Granularity of the query result, in seconds, you can select 60, 300 and 3,600, and the default is 300.

Response body

Parameter Type Description
details list type, HitRateDetails content items are explained as follows:
- timestamp: Timestamp type, indicating the time point.
- hitrate: Double type, indicating the byte hit rate in the statistical period.
Data details

Request example

GET /v2/stat/hitrate?domain=my.test.com&endTime=2016-10-13T02%3A00%3A00Z&period=3600&startTime=2016-10-13T00%3A00%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

Response 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 

{ 
  "details": 
  [ 
    {"timestamp":"2016-10-13T00:00:00Z","hitrate":0.98262418395615}, 
    {"timestamp":"2016-10-13T01:00:00Z","hitrate":0.98021363702777} 
  ] 
} 

Interface to Query Status Code Statistics

Method Path Description
GET /v2/stat/httpcode Query domain name status code statistics

URL parameters:

Parameter optional or not Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas. If not specified, it returns the number of status codes of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 31 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
period Optional Int Granularity of the query result, in seconds, you can select 300, 3,600 and 86,400, and the default is 300.
withRegion Optional Bool Query access distribution details at clients. When this item is included, the number of details in the result cannot exceed 64.
prov Optional String Full spell of the province queried, and it is empty by default. Query national data. It cannot be used with withRegion at the same time.
isp Optional String ISP code to be queried, it is empty by default. Query all operator data. It cannot be used with withRegion at the same time.

Response body

Parameter Type Description
details list, please see the explanation of in the following table Data details

HttpCodeDetails content:

Parameter Type Description
timestamp Timestamp Time point, UTC time
counters For list, please see < KvCounter> in the following table. HTTP status code counting
regions list, please see the explanation of < HttpCodeRegionData> in the following table Detailed data by client access region distribution

HttpCodeRegionData content:

Parameter Type Description
location String Province and region where the client is located
isp String Client affiliated to ISP
counters list, please see the explanation of < KvCounter> in the following table HTTP status code counting

KvCounter content:

Parameter Type Description
name String Statistics
value Int Statistics counting

Request example

GET /v2/stat/httpcode?domain=my.test.com&endTime=2016-10-13T02%3A00%3A00Z&period=3600&startTime=2016-10-13T00%3A00%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

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 
 
{ 
  "details": 
  [ 
    { 
      "timestamp":"2016-10-13T00:00:00Z", 
      "counters": [ 
        {"name":"504","value": 12}, 
        {"name":"502", "value": 18}, 
        {"name":"502", "value": 24}, 
        {"name": "206", "value": 66}, 
        {"name": "200", "value":1759884}, 
        {"name": "304", "value": 259405}, 
        {"name": "499", "value": 602}, 
        {"name": "404", "value": 1902} 
    ] 
    }, 
    { 
      "timestamp":"2016-10-13T01:00:00Z", 
      "counters": [ 
        {"name":"504","value": 12}, 
        {"name":"502", "value": 18}, 
        {"name":"502", "value": 24}, 
        {"name": "206", "value": 66}, 
        {"name": "200", "value":1759884}, 
        {"name": "304", "value": 259405}, 
        {"name": "499", "value": 602}, 
        {"name": "404", "value": 1902} 
    ], 
    } 
  ] 
} 

TopN urlQuery Interfaces

Method Path Description
GET /v2/stat/topn/url Query top100 url list

url parameter:

Parameter Optional Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas. If not specified, it returns the top100 url list of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 31 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
period Optional Int Granularity of the query result, in seconds, you can select 3,600 and 86,400, and the default is 3,600.

Response body

Parameter Type Description
details list type, TopUrlDetails content items are explained as follows:
- timestamp: Timestamp type, indicating the time point, UTC time.
- counters: list type, indicating the Top100 url statistics. KvCounter content items are explained as follows:
- name: String type, indicating the statistical items.
- value: Int type, indicating the statistical counting.
Data details

Request example

GET /v2/stat/topn/url?domain=my.test.com&endTime=2016-10-22T03%3A01%3A00Z&period=3600&startTime=2016-10-22T01%3A57%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

Response example

HTTP/1.1 200 OK 
Content-Length: 7113
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN 
 
{ 
    "details": [ 
    { 
      "timestamp": "2016-10-22T02:00:00Z", 
      "counters": 
      [ 
        {"name":"http://my.test.com/path/to/file1.png", "value": 2551}, 
        {"name":"http://my.test.com/path/to/file2.gif", "value": 1195}, 
        {"name":"http://my.test.com/path/to/file3.jpg", "value": 932}, 
        {"name":"http://my.test.com/path/to/file4.mp4", "value": 846}, 
        {"name":"http://my.test.com/path/to/file5.css", "value": 544}, 
        {"name":"http://my.test.com/path/to/file6.js", "value": 326}, 
        {"name":"http://my.test.com/path/to/file7.flv", "value": 122}, 
        {"name":"http://my.test.com/path/to/file8.zip", "value": 116}, 
        {"name":"http://my.test.com/path/to/file9.doc", "value": 98}, 
        {"name":"http://my.test.com/path/to/file10.mp3", "value": 76}, 
        {"name":"http://my.test.com/path/to/file11.pdf", "value": 18} 
      ] 
    }, 
    { 
    "timestamp": "2016-10-22T03:00:00Z", 
    "counters": 
    [ 
      {"name":"http://my.test.com/path/to/file1.png", "value": 2382}, 
      {"name":"http://my.test.com/path/to/file2.gif", "value": 1245}, 
      {"name":"http://my.test.com/path/to/file3.jpg", "value": 923}, 
      {"name":"http://my.test.com/path/to/file4.mp4", "value": 811}, 
      {"name":"http://my.test.com/path/to/file5.css", "value": 532}, 
      {"name":"http://my.test.com/path/to/file6.js", "value": 423}, 
      {"name":"http://my.test.com/path/to/file7.flv", "value": 209}, 
      {"name":"http://my.test.com/path/to/file8.zip", "value": 155}, 
      {"name":"http://my.test.com/path/to/file9.doc", "value": 84}, 
      {"name":"http://my.test.com/path/to/file10.mp3", "value": 80}, 
      {"name":"http://my.test.com/path/to/file11.pdf", "value": 32} 
     ] 
    } 
  ] 
} 

TopN referer Query Interface

Method Path Description
GET /v2/stat/topn/referer Query top100 referers

URL parameters:

Parameter Optional Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas. If not specified, it returns the top100 referer of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 31 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
period Optional Int Granularity of the query result, in seconds, you can select 3,600 and 86,400, and the default is 3,600.

Response body

Parameter Type Description
details list type, TopRefererDetails content items are explained as follows:
- timestamp: Timestamp type, indicating the time point, UTC time.
- counters: list type, indicating the statistical counting of Top 100 refer. KvCounter content items are explained as follows:
- name: String type, indicating the statistical items.
- value: Int type, indicating the statistical counting.
Data details

Request example

GET /v2/stat/topn/referer?domain=my.test.com&endTime=2016-10-22T02%3A01%3A00Z&period=3600&startTime=2016-10-22T01%3A57%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

Response example

HTTP/1.1 200 OK 
Content-Length: 180
Content-Type: application/json;utf-8
x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
Server: BCE-CDN 
 
{ 
  "details": 
  [ 
    { 
      "timestamp":"2016-10-22T02:00:00Z", 
      "counters": 
      [ 
        {"name":"-", "value":53687}, 
        {"name":"i1.my.test.com", "value":752}, 
        {"name":"i2.my.test.com", "value":393}, 
        {"name":"i3.my.test.com", "value":1} 
      ] 
    } 
  ] 
} 

uv query Interface

Method Path Description
GET /v2/stat/uv Query domain name uv requests

URL parameters:

Parameter Optional Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas. If not specified, it returns the sum of uv of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 90 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
period Optional Int Granularity of the query result, in seconds, you can select 3,600 and 86,400, and the default is 3,600.
withRegion Optional Query access distribution details at clients. When this item is included, the number of details in the result cannot exceed 64.

Response body

Parameter Type Description
details list Data details

UvDetails content

Parameter Type Description
timestamp Timestamp Time point, UTC time
uv Int Number of requests in the statistical period
regions list Distribution data of client accesses, include this item when the request contains the withRegion parameter.

UvRegionData content

Parameter Type Description
location String Province and region where the client is located
isp String Client affiliated to ISP
uv Int Number of requests in the statistical period

Request example

GET /v2/stat/uv?domain=my.test.com&endTime=2016-10-13T02%3A00%3A00Z&period=3600&startTime=2016-10-13T00%3A00%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

Response 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 

{ 
  "details": 
  [ 
    {"timestamp":"2016-10-13T00:00:00Z","uv":1998202}, 
    {"timestamp":"2016-10-13T01:00:00Z","uv":2169932} 
  ] 
} 

Interface to Query Average Rate

Method Path Description
GET /v2/stat/avgspeed Query average rate record

URL parameters:

Parameter Optional Type Description
domain Optional String Domain name queried, you can separate multiple domain names by commas. If not specified, it returns the average of average rates of all domain names of the user.
endTime Optional Timestamp End value of the time range queried, the default is the current time, UTC time. The maximum time span between endTime and startTime is 31 days.
startTime Optional Timestamp Start time of the time range queried, the default is 24 hours ahead of the endTime, UTC time.
period Optional Int Granularity of the query result, in seconds, you can select 300, 3,600 and 86,400, and the default is 3,600.

Response body

Parameter Type Description
details list<AvgSpeedDetails> Data details

AvgSpeedDetails content

Parameter Type Description
timestamp Timestamp Time point, UTC time
avgspeed Int Average rate in the statistical period

Request example

GET /v2/stat/avgspeed?domain=my.test.com&endTime=2016-10-13T02%3A00%3A00Z&period=3600&startTime=2016-10-13T00%3A00%3A00Z HTTP/1.1 
Host: cdn.baidubce.com 

Response 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 
{ 
  "details": 
  [ 
    {"timestamp":"2016-10-13T00:00:00Z","avgspeed":741119469}, 
    {"timestamp":"2016-10-13T01:00:00Z","avgspeed":905548590} 
  ] 
} 
Previous
Uplink Traffic Statistics
Next
Cache Management Interface