1、通过频道号,查询咨询提问记录
2、接口支持https协议
3、接口URL中的{channelId}为"频道号"
http://api.polyv.net/live/v2/chat/{channelId}/getQuestion
http://api.polyv.net/live/v2/chat/2191569/getQuestion?appId=frlr1zazn3&sign=40763580D3C4C34CF268018E154944D3&end=1&begin=0×tamp=1616636714152
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(InteractionQuestionTest.class);
/**
* 查询频道提问记录
* @throws IOException
*/
@Test
public void testGetQuestionList() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String channelId = "2191569";
String url = "http://api.polyv.net/live/v2/chat/"+channelId+"/getQuestion";
Integer begin = 0;
Integer end = 1;
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("begin",begin.toString());
requestMap.put("end",end.toString());
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道提问记录接口返回值:{}",response);
}
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"id": "ef523640-855c-11eb-ac86-91e249016089",
"user": {
"nick": "卉",
"pic": "https://thirdwx.qlogo.cn/mmopen/vi_32/3lMXVJoLMLJibnkFuA23lyqj5MOQufhW5ATvHuB8byssutficHKU0u7OMx5OQgg9WNVuHf44AXfbAMMAZejuYFTg/132",
"userId": "ovtl9t_RxnrTdqkXqkT5Q5lnxp2A",
"sessionId": null,
"userType": "student",
"banned": false,
"channelId": null
},
"content": "很长的提问",
"time": 1615791976356,
"s_userId": null,
"event": "S_QUESTION",
"sourceType": null
},
{
"id": "e9090520-855c-11eb-ac86-91e249016089",
"user": {
"nick": "卉",
"pic": "https://thirdwx.qlogo.cn/mmopen/vi_32/3lMXVJoLMLJibnkFuA23lyqj5MOQufhW5ATvHuB8byssutficHKU0u7OMx5OQgg9WNVuHf44AXfbAMMAZejuYFTg/132",
"userId": "ovtl9t_RxnrTdqkXqkT5Q5lnxp2A",
"sessionId": null,
"userType": "student",
"banned": false,
"channelId": null
},
"content": "提问",
"time": 1615791965810,
"s_userId": null,
"event": "S_QUESTION",
"sourceType": null
}
]
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}