1、分页查询频道问卷结果
2、接口支持https协议
3、参数场次号、查询时间同时存在多个时,按参数优先级从小到大,选其中一个参数作为查询条件
http://api.polyv.net/live/v3/channel/questionnaire/list-answer-records
https://api.polyv.net/live/v3/channel/questionnaire/list-answer-records?endDate=2022-1-1&appId=frlr1zazn3&sign=DE11D3CA8A300BBACCF301172B174532&channelId=1965681&startDate=2020-1-1×tamp=1621845118509
private static final Logger log = LoggerFactory.getLogger(LiveInteractionTest.class);
/**
* 分页查询频道问卷结果
* @throws IOException
*/
@Test
public void testListQuestionnaireByPage() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String channelId = "1965681";
String startDate = "2020-1-1";
String endDate = "2022-1-1";
String url = "http://api.polyv.net/live/v3/channel/questionnaire/list-answer-records";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("startDate",startDate);
requestMap.put("endDate",endDate);
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": [{
"questionnaireId": "fs9v59nq4u",
"questionnaireTitle": "测试试卷,明天会更好调查1",
"lastModified": 1603163828000,
"endTime": 1603163828000,
"questionStats": {
"questions": [{
"questionId": "84c4fcf2a54e4b19859edfaa23e49f1a",
"questionName": "您的兴趣爱好?",
"score": 20,
"totalScore": 0,
"total": 1,
"correctCount": 0,
"a": 1,
"b": 0,
"c": 1,
"d": 0,
"e": 0,
"f": 0,
"g": 0,
"h": 0,
"i": 0,
"j": 0
}],
"total": 1
},
"users": [{
"viewerId": "1603158143775",
"nickname": "长沙观众/62648",
"submitTime": 1603163818000,
"totalScore": 0,
"answers": [{
"questionId": "176a1be7f8f04cb2b9e3691e14a3ae22",
"questionName": "您的性别",
"answer": "B",
"score": 0,
"type": "R"
}],
"param4": null,
"param5": null
}],
"customQuestionnaireId": null
}, {
"questionnaireId": "fs9skpv22f",
"questionnaireTitle": "测试试卷,明天会更好调查2",
"lastModified": 1603158379000,
"endTime": 1603158379000,
"questionStats": {
"questions": [{
"questionId": "f790a51167de4dc0b48f4b184f90be96",
"questionName": "您的兴趣爱好?",
"score": 20,
"totalScore": 20,
"total": 2,
"correctCount": 1,
"a": 2,
"b": 1,
"c": 0,
"d": 0,
"e": 0,
"f": 0,
"g": 0,
"h": 0,
"i": 0,
"j": 0
}],
"total": 2
},
"users": [{
"viewerId": "1603157068752",
"nickname": "长沙观众/30182",
"submitTime": 1603158235000,
"totalScore": 0,
"answers": [{
"questionId": "4e8bfb9e0a3a465c825b3412d248bade",
"questionName": "您的职务?",
"answer": "这是职务",
"score": 0,
"type": "Q"
}, {
"questionId": "5b55d46d2f544a71a604f90392bb452d",
"questionName": "您的性别",
"answer": "A",
"score": 0,
"type": "R"
}, {
"questionId": "f790a51167de4dc0b48f4b184f90be96",
"questionName": "您的兴趣爱好?",
"answer": "A",
"score": 0,
"type": "C"
}],
"param4": null,
"param5": null
}, {
"viewerId": "1603158143775",
"nickname": "长沙观众/62648",
"submitTime": 1603158312000,
"totalScore": 20,
"answers": [{
"questionId": "4e8bfb9e0a3a465c825b3412d248bade",
"questionName": "您的职务?",
"answer": "teacher",
"score": 0,
"type": "Q"
}, {
"questionId": "5b55d46d2f544a71a604f90392bb452d",
"questionName": "您的性别",
"answer": "A",
"score": 0,
"type": "R"
}, {
"questionId": "f790a51167de4dc0b48f4b184f90be96",
"questionName": "您的兴趣爱好?",
"answer": "AB",
"score": 20,
"type": "C"
}],
"param4": null,
"param5": null
}],
"customQuestionnaireId": null
}],
"startRow": 1,
"firstPage": true,
"lastPage": true,
"prePageNumber": 1,
"limit": 2,
"nextPageNumber": 1,
"endRow": 2,
"totalPages": 1,
"offset": 0
}
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}