保利威文档中心

幫助中心

分頁查詢頻道可設定接收轉播頻道列表

更新時間:2024-09-27 15:54:14

介面描述

1、通过一个(发起转播的)频道分页查询能够被它设置接收转播的频道列表
2、接口支持https协议

介面URL

http://api.polyv.net/live/v3/channel/basic/receive/list

線上API呼叫

請求方式

GET

介面限制

1、介面同時支援HTTP、HTTPS,建議使用HTTPS確保介面安全,介面呼叫有頻率限制,詳細請查看

請求參數描述

參數名 必選 類型 說明
appId true String 帳號appId【詳見取得金鑰
timestamp true Long 目前13位毫秒級時間戳記,3分鐘內有效
sign true String 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則
channelId true String (發起轉播的)頻道號
keyword false String 頻道名稱,支援模糊搜尋
page false Integer 查詢頁數,預設1
pageSize false Integer 每頁資料大小,預設10

範例

http://api.polyv.net/live/v3/channel/basic/receive/list?appId=frlr1zazn3&sign=56C6413F1606D8950C0BCE2AEC7CD456&channelId=2788479&timestamp=1642493607445

回應參數描述

參數名 類型 說明
code Integer 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明
status String 回應狀態文字資訊
message String 回應描述資訊,當code為400或500時,輔助描述錯誤原因
data Object 請求失敗時為空,成功回應時返回全帳號頻道基礎資訊【詳見data參數描述

Data參數描述

參數名 類型 說明
pageSize Integer 每頁資料大小,預設20,最大20
pageNumber Integer 目前頁數
totalItems Integer 總筆數
contents Array 查詢的結果列表【詳見Contents參數描述
startRow Integer 目前頁第一筆記錄在總結果集中的位置
firstPage Boolean 是否為第一頁,值為:true/false,預設為false
lastPage Boolean 是否為最後一頁,值為:true/false,預設為false
prePageNumber Integer 上一頁編號
limit Integer 每頁數量大小
nextPageNumber Integer 下一頁編號
endRow Integer 目前頁最後一筆記錄在總結果集中的位置
totalPages Integer 總頁數
offset Integer 分頁起始記錄

Contents參數描述

參數名 類型 說明
channelId String 頻道號
name String 頻道名稱
channelPasswd String 頻道密碼,非研討會場景使用
hostPasswd String 研討會主持人密碼,研討會場景使用
attendeePasswd String 研討會與會人密碼,研討會場景使用
categoryName String 頻道所屬分類名稱
authType String 觀看條件,使用,分隔,如:none,none
none:無條件,
pay:付費觀看,
code:驗證碼觀看,
phone:白名單觀看,
info:登記觀看,
custom:自訂授權觀看,
external:外部授權,
direct:直接授權
recentViewCount Integer 最近場次觀看人數
subChannelAccount String 第一個子頻道號,如果沒有子頻道則為null
subChannelPasswd String 第一個子頻道密碼,如果沒有子頻道則為null
startTime String 直播開始時間
transmitChannelId String 關聯轉播的頻道號,如果沒有關聯則為null
scene String 場景
alone:活動直播
ppt:三分屏
topclass:大班課

Java請求範例

快速接入基礎程式碼請下載相關依賴原始碼點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。

強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK 對API呼叫邏輯、例外處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。

    @Test
    public void testGetReceiveList() throws IOException, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;
        String appSecret = super.appSecret;
        String timestamp = String.valueOf(System.currentTimeMillis());
        
        //业务参数
        String channelId = "2788479";
        String url = "http://api.polyv.net/live/v3/channel/basic/receive/list";
        
        //http 调用逻辑
        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("channelId", channelId);
        //requestMap.put("keyword","");
        //requestMap.put("page","");
        //requestMap.put("pageSize","");
        requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
        url = MapUtil.appendUrl(url, requestMap);
        String response = HttpUtil.get(url, null);
        log.info("测试分页查询频道可设置接收转播频道列表接口返回值:{}", response);
    }

回應範例

系統全域錯誤說明詳見全域錯誤說明

成功範例

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "pageSize": 10,
        "pageNumber": 1,
        "totalItems": 1,
        "contents": [
            {
                "channelId": 1972965,
                "name": "Spring 知识精讲",
                "passwd": null,
                "hostPasswd": null,
                "attendeePasswd": null,
                "categoryName": "默认分类",
                "authType": "none,none",
                "status": 7,
                "recentViewCount": 0,
                "subChannelAccount": null,
                "subChannelPasswd": null,
                "watchUrl": null,
                "watchQRCodeUrl": null,
                "scene": "alone",
                "type": "receive",
                "startTime": null,
                "guest": null,
                "pureRtcEnabled": "N",
                "transmitType": "single",
                "multipleRoom": null,
                "creatorChildId": null,
                "creatorName": null,
                "rtcType": "agora",
                "transmitChannelId": null,
                "channelPasswd": "3I85nJ"
            }
        ],
        "offset": 0,
        "limit": 1,
        "nextPageNumber": 1,
        "totalPages": 1,
        "endRow": 1,
        "startRow": 1,
        "firstPage": true,
        "lastPage": true,
        "prePageNumber": 1
    }
}

異常範例

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询