Polyv Help Center

Help Center

Query Audience Response to Channel Questionnaire Details

Updated: 2022-09-02 18:08:07

Interface URL

https://api.polyv.net/live/v3/channel/questionnaire/detail-by-viewer

Interface Description

1、接口用于查询观众回答频道问卷详情
2、问卷ID可以从获取频道问卷列表中获取
3、接口支持https

Response Format

JSON

Request Method

GET

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live streaming system
timestamp Yes long Current 13-digit millisecond timestamp, valid within 3 minutes
sign Yes 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 to obtain response data. See Signature Generation Rules
channelId Yes int Channel ID
questionnaireId Yes string Questionnaire ID
viewerId Yes string Viewer ID

Successful Response JSON Example:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "questionnaireId": "fefg598lfj",
        "customQuestionnaireId": "ddddxxx222",
        "channelId": 108888,
        "userId": "edvf2fpec9",
        "name": "测试问卷_1564105496583",
        "status": "forbidden",
        "createdTime": 1564105498000,
        "lastModified": 1564105498000,
        "endTime": 1564105580000,
        "questions": [
            {
                "questionId": "3839e04e78",
                "channelId": 108888,
                "userId": "edvf2fpec9",
                "name": "您觉得课程怎么样",
                "type": "C",
                "option1": "好",
                "option2": "很好",
                "option3": "非常好",
                "option4": "超级好",
                "option5": "以上都对",
                "createdTime": 1564105498000,
                "lastModified": 1564105498000,
                "answer": "",
                "note": null,
                "templateId": null,
                "status": "draft",
                "times": 0,
                "tips1": null,
                "tips2": null,
                "tips3": null,
                "tips4": null,
                "tips5": null,
                "required": "Y",
                "scoreEnabled": "N",
                "option6": "",
                "option7": "",
                "option8": "",
                "option9": "",
                "option10": "",
                "score": null,
                "itemType": 0,
                "viewerId": "xsxxxxx",
                "param4": "",
                "param5": "",
                "nickname": "aaa",
                "recordAnswer": "C"
            },
            {
                "questionId": "c908c81e80",
                "channelId": 108888,
                "userId": "edvf2fpec9",
                "name": "今后还会不会来",
                "type": "R",
                "option1": "会",
                "option2": "不会",
                "option3": "",
                "option4": "",
                "option5": "",
                "createdTime": 1564105498000,
                "lastModified": 1564105498000,
                "answer": "",
                "note": null,
                "templateId": null,
                "status": "draft",
                "times": 0,
                "tips1": null,
                "tips2": null,
                "tips3": null,
                "tips4": null,
                "tips5": null,
                "required": "Y",
                "scoreEnabled": "N",
                "option6": "",
                "option7": "",
                "option8": "",
                "option9": "",
                "option10": "",
                "score": null,
                "itemType": 0,
                "viewerId": "xsxxxxx",
                "param4": "",
                "param5": "",
                "nickname": "aaa",
                "recordAnswer": "C"
            }
        ]
    }
}

Failed Response JSON Examples:

appId not provided

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

Incorrect appId

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

Timestamp error

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

Signature error

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Questionnaire ID does not exist

{
    "code": 400,
    "data": "",
    "message": "questionnaire is not exist",
    "status": "error"
}

Field Description

Parameter Description
code Response code: 200 for success, 400 for failure, 403 for signature error, 500 for exception error
status success for success, error for failure
message Error message when an error occurs
questionnaireId Questionnaire ID
customQuestionnaireId User-defined questionnaire ID
channelId Channel ID
userId User ID
name Questionnaire name
status Questionnaire status
createdTime Questionnaire creation time
endTime Questionnaire end time
questions List of questionnaire questions

Questionnaire Question Model Class (question)

Parameter Description
questionId Question ID
name Question title
type Question type: R - Single choice; C - Multiple choice; S - Star rating; Q - Q&A
option1~10 Content of options A~G
createdTime Creation time
lastModified Last modification time
scoreEnabled Whether scoring is enabled, values: Y, N
score Question score
required Whether the question is required, values: Y, N
answer Question answer
recordAnswer Recorded answer to the question
viewerId Viewer ID
nickname Viewer nickname
param4 Custom parameter
param5 Custom parameter

Java Request Example

public static void test() {
        String url = "https://api.polyv.net/live/v3/channel/questionnaire/detail-by-viewer";
        // 用户对应的appId和加密串
        String appId = "xxxxxxxxx";
        String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
        int channelId = 10001;
        String questionnaireId = "xxxxx";
        String viewerId = "xxxxx";
        Map<String, String> params = new HashMap<>();
        params.put("channelId", String.valueOf(channelId));
        params.put("questionnaireId", questionnaireId);
        params.put("viewerId", viewerId);
        PolyvTool.setLiveSign(params, appId, appSecret);
        // 调用Polyv的httpClient工具类发送请求
        String content = HttpClientUtil.getInstance()
                .sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
        System.out.println(content);
    }
联系客服,在线咨询