Polyv Help Center

Help Center

Paginated Query of Channel Survey Results

Updated: 2025-05-23 14:54:00

Interface Description

1、分页查询频道问卷结果
2、接口支持https协议
3、参数场次号、查询时间同时存在多个时,按参数优先级从小到大,选其中一个参数作为查询条件

Interface URL

http://api.polyv.net/live/v3/channel/questionnaire/list-answer-records

Online API Call

Request Method

GET

Interface Constraints

  1. The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details on obtaining keys
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 and must never be saved or used directly on the client. 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
page false Integer Page number to query, defaults to 1
pageSize false Integer Number of items per page, defaults to 10
sessionId false String Session ID, priority 1
startDate false String Start time, priority 2, format: yyyy-MM-dd, defaults to the last 7 days
endDate false String End time, priority 2, format: yyyy-MM-dd, defaults to the last 7 days

Example

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&timestamp=1621845118509

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See global error description
status String Response status text
message String Response description, assists in describing error reasons when code is 400 or 500
data Object Basic survey information on successful response See data field description

data Field Description

Parameter Type Description
pageSize Integer Total number of pages
pageNumber Integer Current page number
totalItems Integer Total number of items
contents Array Channel survey information and statistical results See contents field description
firstPage Boolean Whether it is the first page, values: true/false
lastPage Boolean Whether it is the last page, values: true/false
nextPageNumber Integer Next page number
prePageNumber Integer Previous page number
totalPages Integer Total number of pages
startRow Integer Position of the first record on the current page in the total records
endRow Integer Position of the last record on the current page in the total records
limit Integer Number of records on the current page
offset Integer Pagination starting record

contents Field Description

Parameter Type Description
questionnaireId String Survey ID
customQuestionnaireId String User-defined survey ID
questionnaireTitle String Survey name
lastModified Long Update time, 13-digit millisecond timestamp
endTime Long Survey end time, 13-digit millisecond timestamp
questionStats Object Answer statistics for each question in the survey 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 survey questions See questions field description
total Integer Number of respondents for the questions

questions Field Description

Parameter Type Description
questionId String Question ID
questionName String Question name
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

users Field Description

Parameter Type Description
viewerId String User ID who submitted the survey
nickname String Nickname of the user who submitted the survey
totalScore Integer Total score of the user who submitted the survey
submitTime Long Date of survey submission, 13-digit millisecond timestamp
answers Array User's answer status 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 name
answer String Submitted answer
score Integer User's score for the answer
type String Question type
R: Single choice
C: Multiple choice
Q: Essay question
J: True/False
X: Rating question

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 HttpUtil.java and LiveSignUtil.java in the test cases are included in the downloaded 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
 */
@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
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "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
    }
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询