查詢所有頻道的詳細資訊
更新時間:2024-12-16 19:20:19
介面描述
1、查询账号下所有频道详细信息列表
2、接口支持https协议
介面URL
http://api.polyv.net/live/v3/channel/management/list-detail
請求方式
POST
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS確保介面安全,介面呼叫有頻率限制,詳細請查看
請求參數描述
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | true | String | 帳號appId【詳見取得金鑰】 |
| timestamp | true | Long | 當前13位毫秒級時間戳,3分鐘內有效 |
| sign | true | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| page | false | Integer | 頁數預設為1 |
| pageSize | false | Integer | 每頁顯示的資料筆數,預設每頁顯示20筆資料 |
| categoryId | false | String | 所屬分類ID |
| watchStatus | false | String | 觀看頁狀態篩選 live:直播中 playback:回放中 end:已結束 waiting:等待中 |
| keyword | false | String | 頻道名稱,模糊查詢 |
範例
http://api.polyv.net/live/v3/channel/management/list-detail
表單參數:
watchStatus=playback&appId=frlr1zazn3&sign=BDEE4A11F8720DC0FD40E33DE159536B&pageSize=20&page=1&keyword=%E6%B5%8B%E8%AF%95&categoryId=345134×tamp=1621841244430
回應參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明】 |
| status | String | 回應狀態文字資訊 |
| message | String | 回應描述資訊,當code為400或500時,輔助描述錯誤原因 |
| data | Object | 回應成功時返回頻道詳細資訊【詳見data欄位說明】 |
Data參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| pageSize | Integer | 每頁資料大小,預設20筆資料 |
| pageNumber | Integer | 目前頁數 |
| totalItems | Integer | 總筆數 |
| contents | Array | 頻道詳細資訊列表【詳見Contents參數描述】 |
| startRow | Integer | 目前頁第一筆記錄在總結果集中的位置 |
| firstPage | Boolean | 是否為第一頁,值為:true/false,預設為false |
| lastPage | Boolean | 是否為最後一頁,值為:true/false,預設為false |
| prePageNumber | Integer | 上一頁編號 |
| limit | Integer | 每頁數量大小 |
| totalPages | Integer | 總頁數 |
| endRow | Integer | 目前頁最後一筆記錄在總結果集中的位置 |
| nextPageNumber | Integer | 下一頁編號 |
| offset | Integer | 分頁起始記錄 |
Contents參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| channelId | String | 頻道號 |
| name | String | 頻道名稱 |
| channelPasswd | String | 頻道密碼 |
| categoryId | String | 分類ID |
| scene | String | 場景 alone:活動直播 ppt:三分屏 topclass:大班課 seminar:研討會 |
| watchStatus | String | 觀看頁狀態 live:直播中 playback:回放中 end:已結束 waiting:等待中 |
| watchStatusText | String | 觀看頁狀態描述,直播中,回放中,已結束,等待中 |
| sceneText | String | 場景描述 |
| watchUrl | String | 觀看頁連結 |
| content | String | 直播介紹 |
| startTime | Long | 直播開始時間,13位毫秒級時間戳 |
| channelLogo | String | 頻道圖示 |
| splashImg | String | 頻道引導圖 |
| splashEnabled | String | 引導頁開關 Y:開啟 N:關閉 |
| publisher | String | 主持人名稱 |
| authSetting | Array | 觀看條件設定【詳見authSetting參數描述】 |
authSetting參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| channelId | String | 頻道號 |
| rank | Integer | 用於實現一個頻道設定兩個觀看條件,為1或2 1:主要條件 2:次要條件 |
| userId | String | POLYV使用者ID,與保利威官網一致,取得路徑:官網->登入->直播(開發設定) |
| globalSettingEnabled | String | 是否開啟全域設定 Y:開啟 N:關閉 |
| enabled | String | 是否開啟觀看條件 Y:開啟 N:關閉 |
| authType | String | 觀看條件類型 none:無限制 code:驗證碼觀看 pay:付費觀看 phone:白名單觀看 info:登記觀看 wxshare:分享觀看 custom:自訂授權觀看 external:外部授權觀看 |
| payAuthTips | String | 付費觀看提示資訊 |
| price | Float | 付費觀看的價格 |
| watchEndTime | Long | 付費觀看,截止時間,13位毫秒級時間戳,為null表示:一次付費,永久有效 |
| validTimePeriod | Integer | 付費觀看的截止時長(天) |
| infoAuthTips | String | 登記觀看提示資訊 |
| infoDesc | String | 登記觀看的描述欄位 |
| codeAuthTips | String | 驗證碼觀看提示資訊 |
| authCode | String | 驗證碼觀看的驗證碼 |
| qcodeTips | String | 驗證碼觀看的二維碼提示 |
| qcodeImg | String | 驗證碼觀看的二維碼圖片 |
| customKey | String | 自訂授權觀看的key |
| customUri | String | 自訂授權觀看的介面地址 |
| externalKey | String | 外部授權觀看的key |
| externalUri | String | 外部授權觀看的介面地址 |
| externalRedirectUri | String | 外部授權觀看,使用者直接存取觀看頁時的跳轉地址 |
| directKey | String | 獨立授權key |
| trialWatchEnabled | String | 試看開關 Y:開啟試看 N:關閉試看 |
| trialWatchTime | Integer | 試看時間,單位為分鐘 |
| trialWatchEndTime | Long | 試看截止日期,13位毫秒級時間戳,為null 表示對該頻道永久有效 |
| authTips | String | 白名單觀看提示資訊 |
| whiteListInputTips | String | 白名單輸入提示 |
| whiteListEntryText | String | 白名單入口文案 |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼, 點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。
強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK 對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
private static final Logger log = LoggerFactory.getLogger(AccountTest.class);
/**
* 查询所有频道的详细信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testChannelDetail() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url="http://api.polyv.net/live/v3/channel/management/list-detail";
String categoryId="345134";
String watchStatus="playback";
String keyword="测试";
String page=String.valueOf(2);
String pageSize=String.valueOf(20);
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("categoryId", categoryId);
requestMap.put("watchStatus", watchStatus);
requestMap.put("keyword", keyword);
requestMap.put("page", page);
requestMap.put("pageSize", pageSize);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url, requestMap);
log.info("测试查询所有频道的详细信息,返回值:{}", response);
//do somethings
}
回應範例
系統全域錯誤說明詳見全域錯誤說明
成功範例
{
"code":200,
"status":"success",
"message":"",
"data":{
"pageSize":20,
"pageNumber":1,
"totalItems":1,
"contents":[
{
"channelId":2191569,
"name":"测试",
"channelPasswd":"******",
"categoryId":"345134",
"scene":"ppt",
"watchStatus":"playback",
"watchStatusText":"回放中",
"sceneText":"三分屏",
"watchUrl":"https://live.polyv.cn/watch/2191569",
"content":"这是直播介绍,可以是html代码",
"startTime":1557888134000,
"channelLogo":"//liveimages.videocc.net/uploaded/images/2021/03/fwzwkziu67.png",
"splashImg":"//liveimages.videocc.net/uploaded/images/2021/03/fwzwkzkn9l.png",
"splashEnabled":"Y",
"publisher":"主持人名称",
"authSetting":[
{
"channelId":2191569,
"rank":1,
"userId":"1b448be323",
"globalSettingEnabled":"N",
"enabled":"Y",
"authType":"external",
"authTips":"欢迎观看本次直播",
"payAuthTips":"欢迎观看本次直播",
"codeAuthTips":"欢迎观看本次直播",
"infoAuthTips":"欢迎观看本次直播",
"authCode":null,
"qcodeTips":null,
"qcodeImg":null,
"price":0,
"watchEndTime":null,
"validTimePeriod":null,
"customKey":"7020hnems4",
"customUri":null,
"externalKey":"L0EjokKI4O",
"externalUri":"http://demo.ipolyv.cn/chenwb/live-validate.php",
"externalRedirectUri":null,
"directKey":"56221g3rv0",
"trialWatchEnabled":"N",
"trialWatchTime":null,
"trialWatchEndTime":null,
"whiteListInputTips":null,
"whiteListEntryText":"会员入口",
"infoDesc":null
},
{
"channelId":2191569,
"rank":2,
"userId":"1b448be323",
"globalSettingEnabled":"N",
"enabled":"N",
"authType":"none",
"authTips":"欢迎观看本次直播",
"payAuthTips":"欢迎观看本次直播",
"codeAuthTips":"欢迎观看本次直播",
"infoAuthTips":"欢迎观看本次直播",
"authCode":null,
"qcodeTips":null,
"qcodeImg":null,
"price":0,
"watchEndTime":null,
"validTimePeriod":null,
"customKey":"7020hnems4",
"customUri":null,
"externalKey":"9oh7qu8656",
"externalUri":null,
"externalRedirectUri":null,
"directKey":"56221g3rv0",
"trialWatchEnabled":"N",
"trialWatchTime":null,
"trialWatchEndTime":null,
"whiteListInputTips":null,
"whiteListEntryText":"会员入口",
"infoDesc":null
}
]
}
],
"startRow":1,
"firstPage":true,
"lastPage":true,
"prePageNumber":1,
"limit":1,
"endRow":1,
"totalPages":1,
"nextPageNumber":1,
"offset":0
}
}
異常範例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
