统计接口

查询媒资播放信息

通过媒资的唯一标识 mediaId 查询指定媒资的播放信息,包括指定时间段内的播放次数、最大并发播放次数及下行流量。

请求语法

GET /v<version>/statistic/media/<mediaId> HTTP/1.1
accept-encoding: gzip, deflate
x-bce-date: <utc-date-string>
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
x-bce-request-id: <bce-request-id>
content-type: application/json
authorization: <bce-authorization-string>

请求参数

参数 类型 描述 是否必须
mediaId String 系统生成的媒资的唯一标识mediaId
startTime String 查询时间段的起始时间,按日统计,格式举例:2018-02-07
endTime String 查询时间段的结束时间
aggregate Boolean 指定是否聚合,即数据聚合统计或按日统计。有效值:true、false,默认值: true。为true时聚合统计;否则按日统计

请求示例

GET /v1/statistic/media/mda-gc0ag2hus3purc5q?startTime=2016-06-02T16:00:00Z&endTime=2016-06-03T16:00:00Z&aggregate={true|false} HTTP/1.1
accept-encoding: gzip, deflate
x-bce-date: 2015-07-03T09:28:13Z
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
x-bce-request-id: 012b9747-f13a-4a2c-a488-02b221844dca
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715

{
    "startTime":"2016-06-02",
    "endTime":"2016-06-03"
}

响应头域

无特殊响应头域。

响应参数

参数 类型 描述
startTime String 查询时间段的起始时间,按日统计,格式举例:2018-02-07
endTime String 查询时间段的结束时间
aggregate MediaStatisticsElement 聚合统计数据,仅当aggregate=true时存在
statistics MediaStatisticsElement 按日统计数据
+timestamp String 时间戳
+playCount Integer 播放次数,视频开始播放即为1次播放量,多次播放将累计计算
+downstreamInByte Integer 媒资总下行流量
+peakPlayCount Integer 媒资最大并发

响应示例

aggregate值为true

HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 012b9747-f13a-4a2c-a488-02b221844dca
Cache-Control: no-cache
Server: BWS
Date: Tue, 24 Mar 2015 13:34:07 GMT
Content-Type: application/json;charset=UTF-8
{
    "startTime": "2016-06-02",
    "endTime": "2016-06-03",
    "aggregate": {
        "playCount": 110,
        "downstreamInBytes": 30720,
        "peakPlayCount": 10
    }
}

aggregate值为false

HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 012b9747-f13a-4a2c-a488-02b221844dca
Cache-Control: no-cache
Server: BWS
Date: Tue, 24 Mar 2015 13:34:07 GMT
Content-Type: application/json;charset=UTF-8
{
    "createTime": "2016-06-02",
    "endTime": "2016-06-03",
    "statistics": [
        {
            "timestamp": "2016-06-02",
            "playCount": 60,
            "downstreamInBytes": 10240,
            "peakPlayCount": 110
        },
        {
            "timestamp": "2016-06-03",
            "playCount": 50,
            "downstreamInBytes": 20480,
            "peakPlayCount": 90
        }
    ]
}