1、查询频道观看终端分布统计信息
2、接口支持https协议
http://api.polyv.net/live/v4/channel/statistics/browser-summary
http://api.polyv.net/live/v4/channel/statistics/browser-summary?appId=frlr1zazn3&sign=BC1EE579585A98E69120E3350FE3DAC0&startTime=1651386101000&endTime=1652336501462&channelId=2272655×tamp=1652414352304
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 查询频道终端分布数据统计
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void getBrowsersSummaryTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/statistics/browser-summary";
String channelId = "2272655";
String startTime = "1651386101000";
String endTime = "1652336501462";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("startTime", startTime);
requestMap.put("endTime", endTime);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道终端分布数据统计成功:{}", response);
//do somethings
}
{
"code": 200,
"status": "success",
"requestId": "1375e52c9fc041a89ce61daf28f79737.58.16520842026550383",
"data": [
{
"name": "Chrome",
"platform": "pc",
"plays": 101,
"viewers": 11,
"ips": 28,
"playDuration": 586,
"percent": 69.18
},
{
"name": "weixin",
"platform": "mobile",
"plays": 29,
"viewers": 13,
"ips": 10,
"playDuration": 49,
"percent": 19.86
},
{
"name": "Safari",
"platform": "mobile",
"plays": 11,
"viewers": 4,
"ips": 5,
"playDuration": 12,
"percent": 7.53
},
{
"name": "android-sdk",
"platform": "mobile",
"plays": 4,
"viewers": 1,
"ips": 1,
"playDuration": 24,
"percent": 2.74
},
{
"name": "Other",
"platform": "mobile",
"plays": 1,
"viewers": 1,
"ips": 1,
"playDuration": 7,
"percent": 0.68
}
],
"success": true
}
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}