查询频道答题卡答题结果列表

接口URL

https://api.polyv.net/live/v3/channel/question/answer-records

接口说明

1、接口用于获取频道的答题卡答题结果列表
2、接口支持https

支持格式

JSON

请求方式

GET

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 13位当前时间戳
sign string 签名值
channelId int 频道号
startDate string 查询的开始时间
endDate string 查询的结束时间

ps:开始和结束时间为空的默认查最近7天的数据。

响应成功JSON示例:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": [
        {
            "questionId": "f31lrsr9vx",
            "answer": "B",
            "total": 1,
            "correctCount": 0,
            "options": [
                {
                    "title": ",,",
                    "count": 1,
                    "percent": "100.00%"
                },
                {
                    "title": "..",
                    "count": 0,
                    "percent": "0.00%"
                }
            ],
            "records": [
                {
                    "viewerId": "1531987278863",
                    "nickname": "广州观众/79713",
                    "answer": "A",
                    "corrent": false
                }
            ]
        },
        {
            "questionId": "f31lr45sjl",
            "answer": "A",
            "total": 1,
            "correctCount": 1,
            "options": [
                {
                    "title": "nn",
                    "count": 1,
                    "percent": "100.00%"
                },
                {
                    "title": "m,m",
                    "count": 0,
                    "percent": "0.00%"
                }
            ],
            "records": [
                {
                    "viewerId": "1531987278863",
                    "nickname": "广州观众/79713",
                    "answer": "A",
                    "corrent": false
                }
            ]
        }
    ]
}

响应失败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": ""
}

channelId为空

{
  "code": 400, 
  "status": "error", 
  "message": "param should not be empty: channelId", 
  "data": ""
}

channelId为非数字

{
  "code": 400, 
  "status": "error", 
  "message": "param is not number: channelId", 
  "data": ""
}

频道非法

{
  "code": 403, 
  "status": "error", 
  "message": "illegal channel id: 206240", 
  "data": ""
}

字段说明

参数名 说明
code 响应代码,成功为200,失败为400,签名错误为401,异常错误500
status 成功为success,失败为error
message 错误时为错误提示消息
data 答题结果列表数据
questionId 答题ID
answer 题目的答案
total 答题人数
options 题目选项信息列表
title 选项标题
count 选择该选项的人数
percent 选择该选项的人数百分比
records 答题的用户列表
viewerId 答题的用户ID
nickname 答题的用户昵称
answer 答题的用户提交的答案
corrent 答题的用户提交的答案是否正确:false不正确,true正确

php请求示例

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

$channelId="206204";

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => $channelId,
  'startDate' => '2018-07-01',
  'endDate' => '2018-07-18'
);

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

$url = "https://api.polyv.net/live/v3/channel/question/answer-records?".http_build_query($params);

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
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...