Get Channel Quiz List
Updated: 2022-09-02 18:08:07
Interface URL
https://api.polyv.net/live/v3/channel/question/list
Interface Description
1、接口用于获取频道答题卡列表
2、接口支持https
Supported 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 saved 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 for response data. For details, see Signature Generation Rules |
| channelId | Yes | string | Channel ID |
| startDate | No | string | Query start time, format yyyy-MM-dd (if not provided together with endDate, defaults to the last 7 days) |
| endDate | No | string | Query end time, format yyyy-MM-dd (if not provided together with startDate, defaults to the last 7 days) |
| page | No | int | Page number, defaults to 1 |
| pageSize | No | int | Number of items per page, defaults to 10 |
Successful Response JSON Example:
// 成功
{
"code": 200,
"status": "success",
"message": "",
"data": {
"pageNumber": 1,
"totalItems": 7,
"contents": [
{
"questionId": "",
"name": "text",
"type": "text",
"channelId": 4,
"userId": "text",
"note": "text",
"answer": "text",
"lastModified": 9,
"createdTime": 7,
"option4": "text",
"option5": "",
"option2": "text",
"option3": "text",
"option1": "text",
"times": 0
}
],
"startRow": 9,
"firstPage": true,
"nextPageNumber": 3,
"prePageNumber": 2,
"totalPages": 6,
"lastPage": true,
"endRow": 7,
"limit": 10,
"offset": 1
}
}
Failed Response JSON Examples:
No appId 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": ""
}
Field Description
| Parameter | Description |
|---|---|
| code | Response status code, e.g., 200 |
| status | Response status |
| message | Error message |
| data | Response result set |
| data.pageNumber | Page number |
| data.limit | Number of records per page |
| data.totalItems | Total number of records |
| data.firstPage | Whether it is the first page, value: true/false |
| data.lastPage | Whether it is the last page, value: true/false |
| data.nextPageNumber | Next page number |
| data.prePageNumber | Previous page number |
| data.totalPages | Total number of pages |
| data.startRow | Position of the first record on the current page in the list |
| data.endRow | Position of the last record on the current page in the list |
| data.contents[0].questionId | Question ID |
| data.contents[0].name | Question name |
| data.contents[0].type | Question type ("R": single choice, "C": multiple choice, "S": rating, "Q": Q&A) |
| data.contents[0].channelId | Channel ID |
| data.contents[0].userId | User ID |
| data.contents[0].answer | Answer (abcd...) |
| data.contents[0].note | Answer explanation |
| data.contents[0].times | Quiz session number |
| data.contents[0].option1 | Option 1 |
| data.contents[0].option2 | Option 2 |
| data.contents[0].option3 | Option 3 |
| data.contents[0].option4 | Option 4 |
| data.contents[0].option5 | Option 5 |
| data.contents[0].lastModified | Update time |
| data.contents[0].createdTime | Creation time |
PHP Request Example
<?php
//引用config.php
include 'config.php';
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'channelId' => 108888
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "https://api.polyv.net/live/v3/channel/question/list?".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;
?>
