分頁查詢使用者下所有頻道介面
更新時間:2022-09-02 18:08:07
介面URL
http://api.polyv.net/live/v3/channel/management/query-list
介面說明
1、作用:分頁取得使用者下所有頻道資訊
2、介面支援https協定
支援格式
JSON
請求方式
GET
請求參數
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | 是 | string | 從API設定中取得,在直播系統登記的appId |
| timestamp | 是 | string | 目前13位毫秒級時間戳,3分鐘內有效 |
| page | 是 | string | 頁數 |
| pageSize | 否 | string | 每頁顯示的資料筆數,預設每頁顯示1000筆資料 |
| startDate | 否 | string | 建立日期查詢開始日期,格式:yyyy-MM-dd |
| endDate | 否 | string | 建立日誌查詢結束日期,格式:yyyy-MM-dd |
| categoryId | 否 | int | 分類目錄ID |
| channelIds | 否 | string | 頻道ID,多個頻道ID用英文逗號,隔開 |
| channelName | 否 | string | 頻道名稱 |
| status | 否 | string | 頻道狀態,取值:live(直播中)、end(直播結束)、playback(回放中)、waiting(等待直播) |
| sign | 是 | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| liveTimeStart | 否 | long | 按照直播開始時間查詢的開始時間戳 |
| liveTimeEnd | 否 | long | 按照直播開始時間查詢的結束時間戳 |
| listOrderBy | 否 | string | 列表排序分類規則:createTime 頻道建立日期(預設) ,startTime-desc 直播時間降序 startTime-asc 直播時間升序 |
| watchInfoEnabled | 否 | string | 是否輸出頻道對應的點讚數和觀看頁pv數,Y表示需要,N表示不需要,預設不需要 |
回應成功JSON範例:
{
code: 200,
status: "success",
message: "",
data: {
pageSize: 5,
pageNumber: 1,
totalItems: 67,
contents: [
{
channelId: 306336,
name: "测试弹幕转存",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1554266407000,
appId:"dddd",
coverImage:null
},
{
channelId: 302478,
name: "云课堂的推流测试",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1553582996000,
appId:"dddd",
coverImage:null,
"startTime": null,
"teacherName": "讲师名称",
"teacherActor": "讲师昵称"
},
{
channelId: 302232,
name: "直播助手推流测试",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1553563146000,
appId:"dddd",
coverImage:null,
"startTime": null,
"teacherName": "讲师名称",
"teacherActor": "讲师昵称"
},
{
channelId: 290822,
name: "电动蝶阀",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1551456110000,
appId:"dddd",
coverImage:null,
"startTime": null,
"teacherName": "讲师名称",
"teacherActor": "讲师昵称"
},
{
channelId: 289542,
name: "fdfdf",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1551366959000,
appId:"dddd",
coverImage:null,
"startTime": 1552366959000,
"teacherName": "讲师名称",
"teacherActor": "讲师昵称"
}
],
startRow: 1,
firstPage: true,
lastPage: false,
nextPageNumber: 2,
prePageNumber: 1,
limit: 5,
endRow: 5,
totalPages: 14,
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 | 查詢的結果列表 |
| channelId | 頻道ID |
| name | 頻道名稱 |
| status | 頻道狀態,取值:live(直播中)、end(直播結束)、playback(回放中)、waiting(等待直播) |
| statusDiscription | 頻道狀態中文描述 |
| channelPasswd | 頻道密碼 |
| createdTime | 長整型,頻道建立時間戳(13位) |
| appId | 字串,應用ID |
| coverImage | 頻道暖場圖片 |
| startTime | 直播開始時間,為null 表示未設定 |
| teacherName | 講師名稱 |
| teacherActor | 講師頭銜 |
| firstPage | 是否為第一頁,值為:true/false |
| lastPage | 是否為最後一頁,值為:true/false |
| nextPageNumber | 下一頁編號 |
| prePageNumber | 上一頁編號 |
| totalPages | 總頁數 |
| startRow | 目前頁第一筆記錄在總記錄數中的位置 |
| endRow | 目前頁最後一筆記錄在總記錄數中的位置 |
| limit | 目前頁的記錄個數 |
php請求範例
<?php
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$status = "live";
$startDate = "2019-03-12";
$endDate = "2019-04-12";
$page = "1"; //页数
$pageSize="10";//每页显示的数据
$params = array(
'appId'=>$appId,
'startDate'=>$startDate,
'endDate'=>$endDate,
'status'=>$status,
'page'=>$page,
'pageSize'=>$pageSize,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
//接口请求url
$url = "http://api.polyv.net/live/v3/channel/management/query-list?appId=$appId&startDate=$startDate&endDate=$endDate&status=$status&page=$page&pageSize=$pageSize×tamp=$timestamp&sign=$sign";
//输出接口请求结果
echo file_get_contents($url);
?>
