1、基于课节维度查询用户信息
2、接口支持https协议
3、这里的数据只是纯业务统计数据,与计费无关
http://api.polyv.net/hi-class-api/open/statistics/v1/list
http://api.polyv.net/hi-class-api/open/statistics/v1/list?appId=z2gw5icesv&sign=935F4C0CF3EB84A3EFB2BC691DB714A5×tamp=1631780657591&lessonId=7594&pageNumber=1&pageSize=10
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
/**
* 基于课节维度查询用户信息
* @throws IOException
*/
@Test
public void testGetDocList() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = this.appId;
String appSecret = this.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/hi-class-api/open/statistics/v1/list";
String lessonId = "7190";
String pageNumber = "1";
String pageSize = "5";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("lessonId", lessonId);
requestMap.put("pageNumber", pageNumber);
requestMap.put("pageSize", pageSize);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试基于课节维度查询用户信息:{}", response);
}
{
"code": 200,
"status": "success",
"data": {
"pageNumber": 1,
"pageSize": 2,
"totalPages": 3,
"totalItems": 5,
"contents": [
{
"viewerId": "viewer_a",
"nickname": "aaa",
"startTime": "2021-10-01 11:11:01",
"endTime": "2021-10-01 11:11:12",
"joinDuration": "01:01:14",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57",
"operatingSystem": "windows",
"browser": "chrome 94",
"ip": "127.0.0.1",
"isp": "电信",
"country": "中国",
"province": "广东",
"city": "广州"
},
{
"viewerId": "viewer_b",
"nickname": "aaa_bbbb",
"startTime": "2021-10-01 11:10:01",
"endTime": "2021-10-01 11:10:12",
"joinDuration": "01:01:14",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57",
"operatingSystem": "windows",
"browser": "chrome 94",
"ip": "127.0.0.1",
"isp": "移动",
"country": "中国",
"province": "广东",
"city": "广州"
}
]
},
"success": true
}
{
"code": 400,
"status": "error",
"data": "",
"error": {
"code": xx,
"desc": "错误描述"
}
}