1、查询分类下视频播放情况及消耗流量汇总数据
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、从播放行为产生到数据可查询的间隔时间为1~2小时,流量消耗(flowSize字段)的计算依赖于CDN日志,为了保证数据完整性,流量数据需要间隔一个自然日才会生成
4、分类统计功能需开通使用
5、接口支持https协议
http://api.polyv.net/v2/cata/{userid}/stats-info
http://api.polyv.net/v2/cata/1b448be323/stats-info?endDate=2021-09-07&containSubCategory=Y&sign=E83FE698438024F0A1AA81D589DB5690952C9AAC&cataid=1&ptime=1631242976511&startDate=2021-09-02
强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(VodStatisticsTest.class);
/**
* 分类统计接口
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetStatsInfo() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/v2/cata/" + userId + "/stats-info";
String dr = "this_month";
String startDate = "2021-09-02";
String endDate = "2021-09-07";
String cataid = "1";
String containSubCategory = "Y";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("startDate", startDate);
requestMap.put("endDate", endDate);
requestMap.put("cataid", cataid);
requestMap.put("containSubCategory", containSubCategory);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.get(url, requestMap);
log.debug("测试分类统计接口,{}", response);
//do somethings
}
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"current": "2021-09-02",
"pcFlowSize": 0,
"pcVideoView": 1,
"pcPlayDuration": 117,
"mobileFlowSize": 56787796,
"mobileVideoView": 3,
"mobilePlayDuration": 223,
"pcUniqueViewer": 1,
"mobileUniqueViewer": 2
},
{
"current": "2021-09-03",
"pcFlowSize": 4113247,
"pcVideoView": 1,
"pcPlayDuration": 17,
"mobileFlowSize": 0,
"mobileVideoView": 0,
"mobilePlayDuration": 0,
"pcUniqueViewer": 1,
"mobileUniqueViewer": 0
},
{
"current": "2021-09-04",
"pcFlowSize": 0,
"pcVideoView": 0,
"pcPlayDuration": 0,
"mobileFlowSize": 0,
"mobileVideoView": 0,
"mobilePlayDuration": 0,
"pcUniqueViewer": 0,
"mobileUniqueViewer": 0
},
{
"current": "2021-09-05",
"pcFlowSize": 0,
"pcVideoView": 0,
"pcPlayDuration": 0,
"mobileFlowSize": 0,
"mobileVideoView": 0,
"mobilePlayDuration": 0,
"pcUniqueViewer": 0,
"mobileUniqueViewer": 0
},
{
"current": "2021-09-06",
"pcFlowSize": 0,
"pcVideoView": 0,
"pcPlayDuration": 0,
"mobileFlowSize": 0,
"mobileVideoView": 0,
"mobilePlayDuration": 0,
"pcUniqueViewer": 0,
"mobileUniqueViewer": 0
},
{
"current": "2021-09-07",
"pcFlowSize": 0,
"pcVideoView": 0,
"pcPlayDuration": 0,
"mobileFlowSize": 12627,
"mobileVideoView": 0,
"mobilePlayDuration": 0,
"pcUniqueViewer": 0,
"mobileUniqueViewer": 0
}
]
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}