Get Questionnaire List for Multiple Channels
Updated: 2022-09-02 18:08:07
Interface URL
https://api.polyv.net/live/v3/channel/questionnaire/list-mc
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 for 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 stored 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 to obtain response data. See Signature Generation Rules |
| channelIds | Yes | string | Channel IDs, multiple channels separated by commas |
| startTime | No | long | Start time for querying records, 13-digit millisecond timestamp |
| endTime | No | long | End time for querying records, 13-digit millisecond timestamp |
| page | No | int | Page number, default is 1 |
| pageSize | No | int | Number of items per page, default is 10 |
Note: To query by time range, both startTime and endTime must be provided simultaneously.
Successful Response JSON Example:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"pageSize": 10,
"pageNumber": 1,
"totalItems": 2,
"contents": [
{
"questionnaireId": "fefg598lfj",
"channelId": 108888,
"userId": "edvf2fpec9",
"name": "测试问卷_1564105496583",
"status": "forbidden",
"createdTime": 1564105498000,
"lastModified": 1564105498000,
"endTime": 1564105580000,
"customQuestionnaireId": "xxxxxx",
"submitCount": 123
},
{
"questionnaireId": "fefg4s724k",
"channelId": 108888,
"userId": "edvf2fpec9",
"name": "测试问卷",
"status": "forbidden",
"createdTime": 1564105469000,
"lastModified": 1564105469000,
"endTime": 1564105487000,
"customQuestionnaireId": "xxxxxx",
"submitCount": 123
},
,
{
"questionnaireId": "fefg4s724j",
"channelId": 108887,
"userId": "edvf2fpec9",
"name": "测试问卷3",
"status": "forbidden",
"createdTime": 1564105469000,
"lastModified": 1564105469000,
"endTime": 1564105487000,
"customQuestionnaireId": "xxxxxx",
"submitCount": 123
}
],
"startRow": 1,
"firstPage": true,
"lastPage": true,
"nextPageNumber": 1,
"prePageNumber": 1,
"limit": 2,
"endRow": 2,
"totalPages": 1,
"offset": 0
}
}
Failed Response JSON Example:
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 |
| pageNumber | Current page number |
| totalItems | Total number of items |
| contents | Query result list |
| questionnaireId | Questionnaire ID |
| channelId | Channel ID |
| userId | User ID |
| name | Questionnaire name |
| status | Questionnaire status, values: saved, published, forbidden (questionnaire completed) |
| createdTime | Questionnaire creation time |
| lastModified | Questionnaire last modified time |
| endTime | Time to stop submitting the questionnaire |
| customQuestionnaireId | User-defined questionnaire ID |
| submitCount | Number of questionnaire submissions |
| firstPage | Whether it is the first page, value: true/false |
| lastPage | Whether it is the last page, value: true/false |
| nextPageNumber | Next page number |
| prePageNumber | Previous page number |
| totalPages | Total number of pages |
| startRow | Position of the first video on the current page in the playback list |
| endRow | Position of the last video on the current page in the playback list |
| limit | Number of videos on the current page |
PHP Request Example
<?php
//引用config.php
include 'config.php';
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'channelIds' => "108888"
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "https://api.polyv.net/live/v3/channel/questionnaire/list-mc?".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;
?>
