Query Channel Questionnaire Results
Updated: 2026-06-12 09:57:59
API Description
1、查询直播问卷的答题结果及统计
2、接口支持https协议
3、参数问卷ID、场次号、查询时间同时存在多个时,按参数优先级从小到大,选其中一个参数作为查询条件
API URL
http://api.polyv.net/live/v3/channel/questionnaire/answer-records
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls have frequency limits. Click for details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See: Get Secret Key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See: Signature Generation Rules |
| channelId | true | String | Channel ID |
| questionnaireId | false | String | Questionnaire ID, priority 1. Obtained from Query Channel Questionnaire List |
| sessionId | false | String | Session ID, priority 2 |
| startDate | false | String | Start time, priority 3. Format: yyyy-MM-dd. Defaults to the last 7 days of data |
| endDate | false | String | End time, priority 3. Format: yyyy-MM-dd. Defaults to the last 7 days of data |
Example
https://api.polyv.net/live/v3/channel/questionnaire/answer-records?endDate=2022-1-1&appId=frlr1zazn3&sign=92DC9A760C540DDCC7D7A3A020588DF8&channelId=1965681&startDate=2020-1-1×tamp=1621845075669
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure See: Global Error Description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides auxiliary error reason |
| data | Array | Basic questionnaire information on successful response See: data field description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| questionnaireId | String | Questionnaire ID |
| customQuestionnaireId | String | User-defined questionnaire ID |
| questionnaireTitle | String | Questionnaire title |
| questionnaireType | String | Questionnaire type. Values: survey: Survey, exam: Quiz, lottery: Lottery Draw |
| lastModified | Long | Update time, 13-digit millisecond timestamp |
| endTime | Long | Questionnaire end time, 13-digit millisecond timestamp |
| questionStats | Object | Answer statistics for each question in the questionnaire See: questionStats field description |
| users | Array | Answer submission information from viewers See: users field description |
questionStats Field Description
| Parameter | Type | Description |
|---|---|---|
| questions | Array | List of questionnaire questions See: questions field description |
| total | Integer | Number of respondents for the question |
questions Field Description
| Parameter | Type | Description |
|---|---|---|
| questionId | String | Question ID |
| questionName | String | Question title |
| score | Integer | Question score |
| totalScore | Integer | Total score for the question |
| correctCount | Integer | Number of correct answers for the question |
| a-t | Integer | Number of respondents for options a through t respectively |
users Field Description
| Parameter | Type | Description |
|---|---|---|
| viewerId | String | User ID who submitted the questionnaire |
| nickname | String | Nickname of the user who submitted the questionnaire |
| totalScore | Integer | Total score of the user who submitted the questionnaire |
| submitTime | Long | Date of submission, 13-digit timestamp |
| answers | Array | User's answers for each question See: answers field description |
| param4 | String | Custom parameter for identifying a unique viewer |
| param5 | String | Custom parameter for identifying a unique viewer |
answers Field Description
| Parameter | Type | Description |
|---|---|---|
| questionId | String | Question ID |
| questionName | String | Question title |
| answer | String | Submitted answer for the question |
| score | Integer | User's score for the question |
| type | String | Question type R: Single Choice C: Multiple Choice Q: Essay Question J: True/False X: Star Rating |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. The test cases HttpUtil.java and LiveSignUtil.java are included in the download file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(LiveInteractionTest.class);
/**
* 查询频道问卷结果
* @throws IOException
*/
public void testGetQuestionnaireResult() 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 = "https://api.polyv.net/live/v3/channel/questionnaire/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
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": [{
"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"
}],
"param4": null,
"param5": null
}, {
"viewerId": "1603158143775",
"nickname": "长沙观众/62648",
"submitTime": 1603158312000,
"totalScore": 20,
"answers": [{
"questionId": "4e8bfb9e0a3a465c825b3412d248bade",
"questionName": "您的职务?",
"answer": "teacher",
"score": 0,
"type": "Q"
}],
"param4": null,
"param5": null
}],
"customQuestionnaireId": null
}, {
"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
}]
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
