取得多個頻道的問卷列表
更新時間:2022-09-02 18:08:07
介面URL
https://api.polyv.net/live/v3/channel/questionnaire/list-mc
介面說明
1、接口用于获取多个频道的问卷列表,包括改已经提交数量
2、接口支持https
支援格式
JSON
請求方式
GET
請求參數
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | 是 | string | 從API設定中取得,在直播系統登記的appId |
| timestamp | 是 | long | 當前13位毫秒級時間戳,3分鐘內有效 |
| sign | 是 | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| channelIds | 是 | string | 頻道號,多個頻道用英文逗號,隔開 |
| startTime | 否 | long | 查詢記錄的開始時間,13位毫秒級時間戳 |
| endTime | 否 | long | 查詢記錄的結束時間,13位毫秒級時間戳 |
| page | 否 | int | 頁號,預設為1 |
| pageSize | 否 | int | 每頁筆數,預設為10 |
注意:要按時間區間查詢時,startTime 和 endTime 必須同時傳參才能生效
回應成功JSON範例:
{
"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
}
}
回應失敗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": ""
}
欄位說明
| 參數名 | 說明 |
|---|---|
| code | 回應的狀態碼,例如:200 |
| status | 回應狀態 |
| message | 異常錯誤資訊 |
| data | 回應結果集 |
| pageNumber | 目前的頁數 |
| totalItems | 總筆數 |
| contents | 查詢的結果列表 |
| questionnaireId | 問卷ID |
| channelId | 頻道ID |
| userId | 使用者ID |
| name | 問卷名稱 |
| status | 問卷狀態,取值:saved(已儲存),published (已發布),forbidden (問卷已完成填寫) |
| createdTime | 問卷建立時間 |
| lastModified | 問卷最後修改時間 |
| endTime | 停止提交問卷時間 |
| customQuestionnaireId | 使用者自訂問卷ID |
| submitCount | 問卷提交數量 |
| firstPage | 是否為第一頁,值為:true/false |
| lastPage | 是否為最後一頁,值為:true/false |
| nextPageNumber | 下一頁編號 |
| prePageNumber | 上一頁編號 |
| totalPages | 總頁數 |
| startRow | 當前頁第一個影片在回放影片中的位置 |
| endRow | 當前頁最後一個影片在回放影片中的位置 |
| limit | 當前頁影片個數 |
php請求範例
<?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;
?>
