http://api.polyv.net/live/v2/channels/{channelId}/get-question-record
1、作用:获取直播答题的用户答题记录的分页结果。
2、接口支持https协议
3、接口URL中的{channelId}为 频道ID
{
"code": 200,
"status": "success",
"message": "",
"data": {
"pageNumber": 1,
"totalItems": 1,
"contents": [
{
"recordId": "ezik85p9kw",
"channelId": 10001,
"questionId": "1c6dc3c666",
"viewerId": "oooii099",
"viewerName": "哈哈哈哈",
"answer": "a",
"createdTime": 1522032824000,
"lastModified": 1522032824000
}
],
"endRow": 1,
"lastPage": true,
"totalPages": 1,
"firstPage": true,
"startRow": 1,
"nextPageNumber": 1,
"prePageNumber": 1,
"offset": 0,
"limit": 1
}
}
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
{
"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": ""
}
{
"code": 400,
"status": "error",
"message": "currentDay is empty.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "channel not found.",
"data": ""
}
{
"code": 403,
"status": "error",
"message": "invalid channelId.",
"data": ""
}
<?php
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$channelId = "124545";
$questionId = "1c6dc3c666";
$page = "1"; //页数
$pageSize="10";//每页显示的数据
$params = array(
'appId'=>$appId,
'questionId'=>$questionId,
'page'=>$page,
'pageSize'=>$pageSize,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
//接口请求url
$url = "http://api.polyv.net/live/v2/channels/$channelId/set-question-record?appId=$appId&questionId=$questionId&page=$page&pageSize=$pageSize×tamp=$timestamp&sign=$sign";
//输出接口请求结果
echo file_get_contents($url);
?>