获取问卷详情

接口URL

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

接口说明

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

返回结果格式

JSON

请求方式

GET

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 当前13位毫秒级时间戳,3分钟内有效
sign string 签名,为32位大写的MD5值
channelId int 频道号
questionnaireId 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
            },
            {
                "questionId": "847cd79c2f",
                "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
            },
            {
                "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
            },
            {
                "questionId": "6dba1e90da",
                "channelId": 108888,
                "userId": "edvf2fpec9",
                "name": "请问您对课程有不满意的地方吗",
                "type": "Q",
                "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
            }
        ]
    }
}

响应失败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 问题答案

php请求示例

<?php
//引用config.php
include 'config.php';

$params = array(
    'appId' => $appId,
    'timestamp' => $timestamp,
    'channelId' => 108888,
    'questionnaireId' =>'xxxaaa'
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "https://api.polyv.net/live/v3/channel/questionnaire/detail?".http_build_query($params);

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

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