1、获取研讨会直播间参会者统计数据
2、接口支持https协议
http://api.polyv.net/live/v3/channel/seminar/statistics/listViewLogs
http://api.polyv.net/live/v3/channel/seminar/statistics/listViewLogs?appId=fyirmfdak4×tamp=1638174506033&sign=8796F9B1CB8F000654DF5F84C43532A0&startTime=1635696000000&endTime=1638288000000&channelId=2665820
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(GetSeminarViewLog.class);
/**
* 获取研讨会直播间参会者统计数据
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetSeminarViewLog() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/seminar/statistics/listViewLogs";
String channelId = "2377623";
long startTime = 1633017600000L;
long endTime = 1635696000000L;
int pageSize = 1;
int pageNumber = 10;
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("startTime",String.valueOf(startTime));
requestMap.put("endTime",String.valueOf(endTime));
requestMap.put("pageSize",String.valueOf(pageSize));
requestMap.put("startTime",String.valueOf());
requestMap.put("pageNumber",String.valueOf(pageNumber));
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试获取研讨会直播间参会者统计数据返回值:{}",response);
//do somethings
}
{
"code": 200,
"status": "success",
"message": "",
"data": {
"pageSize": 10,
"pageNumber": 1,
"totalItems": 2,
"contents": [
{
"id": 11065,
"userId": "43f5f9caa2",
"channelId": 2640448,
"viewerId": "7882988f70",
"nickName": "bbb",
"startTime": 1635407075000,
"endTime": 1635409962000,
"stayDuration": 2887,
"micCount": 1,
"micDuration": 2886,
"showCount": 0,
"showDuration": 0,
"currentDay": "2021-10-28",
"browser": "Chrome",
"isMobile": "N",
"ipAddress": "61.144.147.168",
"country": "中国",
"province": "广东",
"city": "广州",
"status": 1,
"createdTime": 1635410039000,
"lastModified": 1635410039000
},
{
"id": 11064,
"userId": "43f5f9caa2",
"channelId": 2640448,
"viewerId": "5c4b866249",
"nickName": "陈",
"startTime": 1635407049000,
"endTime": 1635408507000,
"stayDuration": 1458,
"micCount": 1,
"micDuration": 1457,
"showCount": 0,
"showDuration": 0,
"currentDay": "2021-10-28",
"browser": "Chrome",
"isMobile": "N",
"ipAddress": "61.144.147.168",
"country": "中国",
"province": "广东",
"city": "广州",
"status": 1,
"createdTime": 1635410039000,
"lastModified": 1635410039000
}
],
"limit": 2,
"totalPages": 1,
"endRow": 2,
"nextPageNumber": 1,
"lastPage": true,
"prePageNumber": 1,
"startRow": 1,
"firstPage": true,
"offset": 0
}
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}