分页查询频道问卷结果
接口描述
1、分页查询频道问卷结果
2、接口支持https协议
3、参数场次号、查询时间同时存在多个时,按参数优先级从小到大,选其中一个参数作为查询条件
接口URL
http://api.polyv.net/live/v3/channel/questionnaire/list-answer-records
请求方式
GET
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
timestamp
true
Long
当前13位毫秒级时间戳,3分钟内有效
sign
true
String
签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据
【详见签名生成规则】
channelId
true
String
频道号
page
false
Integer
查询的页数,默认为1
pageSize
false
Integer
查询的每页大小,默认为10
sessionIdId
false
String
场次号,优先级1
startDate
false
String
开始时间,优先级2,格式:yyyy-MM-dd,默认查最近7天数据
endDate
false
String
结束时间,优先级2,格式:yyyy-MM-dd,默认查最近7天数据
示例
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
响应参数描述
data字段说明
pageSize
Integer
总页数
pageNumber
Integer
当前的页数
totalItems
Integer
总的条数
firstPage
Boolean
是否为第一页,值为:true/false
lastPage
Boolean
是否为最后一页,值为:true/false
nextPageNumber
Integer
下一页编号
prePageNumber
Integer
上一页编号
totalPages
Integer
总页数
startRow
Integer
当前页第一条记录在总记录中的位置
endRow
Integer
当前页最后一条记录在总记录中的位置
limit
Integer
当前页记录个数
offset
Integer
分页起始记录
contents字段说明
questionnaireId
String
问卷ID
customQuestionnaireId
String
用户自定义问卷ID
questionnaireTitle
String
问卷名称
lastModified
Long
更新时间,13位毫秒级时间戳
endTime
Long
问卷结束时间,13位毫秒级时间戳
questionStats字段说明
total
Integer
题目的答题人数
questions字段说明
questionId
String
题目ID
questionName
String
题目名称
score
Integer
题目分数
totalScore
Integer
题目的总得分
correctCount
Integer
题目的答对人数
a-j
Integer
选择项a到j分别的答题人数
users字段说明
viewerId
String
提交问卷的用户ID
nickname
String
提交问卷的用户昵称
totalScore
Integer
提交问卷的用户的总得分
submitTime
Long
提交问卷的日期,13位毫秒级的时间戳
param4
String
自定义参数,用于标志唯一观众
param5
String
自定义参数,用于标志唯一观众
answers字段说明
questionId
String
题目ID
questionName
String
题目名称
answer
String
提交的题目答案
score
Integer
用户答题的得分
type
String
题目的类型 R:单选题 C:多项题 Q:问答题
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
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": ""
}
Last updated
Was this helpful?