查询观众回答频道问卷详情

接口URL

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

接口说明

(接口调用有频率限制,详细请查看)

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

返回结果格式

JSON

请求方式

GET

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 当前13位毫秒级时间戳,3分钟内有效
sign string 签名,为32位大写的MD5值
channelId int 频道号
questionnaireId string 问卷id
viewerId string 观众ID

响应成功JSON示例:

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

响应失败JSON示例:

未输入appId

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

appId不正确

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

时间戳错误

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

签名错误

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

问卷ID不存在

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

字段说明

参数名 说明
code 响应代码,成功为200,失败为400,签名错误为403,异常错误500
status 成功为success,失败为error
message 错误时为错误提示消息
questionnaireId 问卷ID
customQuestionnaireId 用户自定义问卷ID
channelId 频道ID
userId 用户ID
name 问卷名称
status 问卷状态
createdTime 问卷创建时间
endTime 停止问卷时间
questions 问卷问题列表

问卷问题模型类question

参数名 说明
questionId 问题ID
name 问题题目
type 问题类型,取值:R 单选;C 多选;S 评星题;Q 问答
option1~10 选项A~G 的内容
createdTime 创建时间
lastModified 最后修改时间
scoreEnabled 是否计分,取值Y、N
score 题目分值
required 是否必填,取值Y、N
answer 问题答案
recordAnswer 问题回答答案
viewerId 观众ID
nickname 观众昵称
param4 自定义参数
param5 自定义参数

Java请求示例

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);
    }

签名规则(PolyvTool.java文件代码查看)

https://dev.polyv.net/2020/liveproduct/l-api/rule/live-api-java-detail/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...