保利威文档中心

幫助中心

批次查詢頻道資訊介面

更新時間:2022-09-13 11:51:28

介面URL

https://api.polyv.net/live/v3/channel/basic/get-channels

介面說明

1、接口用于批量查询频道信息接口息
2、接口支持https

支援格式

JSON

請求方式

GET

請求參數

參數名 必選 類型 說明
appId string 從API設定中取得,在直播系統登記的appId
timestamp long 13位當前時間戳
sign String 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則
channelIds string 頻道號,如果有多個用逗號隔開

回應成功JSON範例:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": [
        {
            "channelId": 1976099,
            "name": "金山cdn",
            "scene": "ppt",
            "channelPasswd": "4bb763",
            "publisher": "易方信息科技股份有限公司",
            "startTime": 0,
            "pageView": 9,
            "likes": 0,
            "coverImg": "//liveimages.videocc.net/uploaded/images/2020/12/fu7jh8cifb.jpg",
            "splashImg": "//liveimages.videocc.net/uploaded/images/2020/12/fu7jl4dfwc.png",
            "splashEnabled": "N",
            "desc": "",
            "consultingMenuEnabled": "Y",
            "maxViewerRestrict": "N",
            "maxViewer": -1,
            "watchStatus": "playback",
            "watchStatusText": "回放中",
            "creatorChildId": null,
            "creatorName": "主账号",
            "userCategory": {
                "categoryId": 177474,
                "categoryName": "默认分类",
                "userId": "ee7fe7fbda",
                "rank": 0
            },
            "authSettings": [
                {
                    "channelId": 1976099,
                    "rank": 1,
                    "userId": "ee7fe7fbda",
                    "globalSettingEnabled": "Y",
                    "enabled": "N",
                    "authType": "phone",
                    "authTips": "欢迎观看本次直播",
                    "payAuthTips": "欢迎观看本次直播",
                    "codeAuthTips": "欢迎观看本次直播",
                    "infoAuthTips": "欢迎观看本次直播",
                    "authCode": null,
                    "qcodeTips": null,
                    "qcodeImg": null,
                    "price": 0.00,
                    "watchEndTime": null,
                    "validTimePeriod": null,
                    "customKey": "92daed0df9",
                    "customUri": null,
                    "externalKey": "432fdf9889",
                    "externalUri": null,
                    "externalRedirectUri": null,
                    "directKey": "e87d4de349",
                    "trialWatchEnabled": "N",
                    "trialWatchTime": null,
                    "trialWatchEndTime": null,
                    "whiteListInputTips": "",
                    "whiteListEntryText": "会员入口",
                    "infoDesc": ""
                },
                {
                    "channelId": 1976099,
                    "rank": 2,
                    "userId": "ee7fe7fbda",
                    "globalSettingEnabled": "Y",
                    "enabled": "N",
                    "authType": "none",
                    "authTips": "欢迎观看本次直播",
                    "payAuthTips": "欢迎观看本次直播",
                    "codeAuthTips": "欢迎观看本次直播",
                    "infoAuthTips": "欢迎观看本次直播",
                    "authCode": null,
                    "qcodeTips": null,
                    "qcodeImg": null,
                    "price": 0.00,
                    "watchEndTime": null,
                    "validTimePeriod": null,
                    "customKey": "0c97e07670",
                    "customUri": null,
                    "externalKey": "33004355bd",
                    "externalUri": null,
                    "externalRedirectUri": null,
                    "directKey": "a4951d801f",
                    "trialWatchEnabled": "N",
                    "trialWatchTime": null,
                    "trialWatchEndTime": null,
                    "whiteListInputTips": null,
                    "whiteListEntryText": "",
                    "infoDesc": null
                }
            ],
            "bgImg": "//liveimages.videocc.net/uploaded/images/2020/12/fu7jmmi8qw.jpg",
            "videoList": [
                {
                    "videoId": "f72f1ae298",
                    "videoPoolId": "ee7fe7fbda102f4d74a264c1b559f6d9_e"
                }
            ]
        }
    ]
}

回應欄位說明

參數名 類型 說明
code int 狀態狀態碼,請求成功時為200
status string 狀態值
message string 請求失敗時回傳的錯誤值
data 包含頻道資訊的陣列物件 請求失敗時為空,請求成功時為頻道的詳細設定資訊

回傳的頻道資訊欄位說明

參數名 類型 說明
channelId int 頻道號
name string 頻道名稱
channelPasswd string 頻道密碼
publisher string 主持人名稱
startTime long 直播開始時間,關閉時為0,開啟時為13位毫秒級時間戳
pageView int 頁面累計觀看數
likes int 觀看頁點讚數
coverImg string 頻道圖示url
splashImg string 頻道引導圖url
splashEnabled string(取值為Y/N) 引導頁開關
desc string 直播介紹
consultingMenuEnabled string(取值為Y/N) 諮詢提問開關
maxViewerRestrict string(取值為Y/N) 限制最大線上觀看人數開關
maxViewer int 最大線上觀看人數
watchStatus string 頻道的觀看頁狀態,取值為: 頻道狀態,取值:live(直播中)、end(直播結束)、playback(回放中)、waiting(等待直播)
watchStatusText string 觀看頁狀態描述,直播中,回放中,已結束,未開始
userCategory object 頻道所屬分類的資訊
userCategory.categoryId int 分類ID
userCategory.categoryName string 分類名稱
userCategory.rank int 分類的排序值
authSettings List< ChannelAuthSetting > 直播觀看條件列表
scene string 直播場景:alone 活動直播, topclass 大班課, ppt 三分屏
bgImg string 暖場圖片
videoList array 回放列表影片
videoList[0].videoId string 影片videoId
videoList[0].videoPoolId string 影片vid
creatorChildId string 建立帳號的子帳號使用者ID(為空則為主帳號建立)
creatorName string 建立頻道的子帳號名稱(主帳號建立的則顯示"主帳號")

關於ChannelAuthSetting 的參數說明請參考該介面的成功回傳結果:查詢直播頻道觀看條件

回應失敗JSON範例:

參數錯誤

{
    "code": 400,
    "status": "error",
    "message": "param validate error",
    "data": 400
}

未輸入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": ""
}

Java請求範例

public void test() {
        String url = "https://api.polyv.net/live/v3/channel/basic/get-channels";
        // 用户对应的appId和加密串
        String appId = "xxxxxxxxx";
        String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
        Map<String, String> params = new HashMap<>();
        params.put("channelIds", "100,1000,30003");
        PolyvTool.setLiveSign(params, appId, appSecret);
        // 调用Polyv的httpClient工具类发送请求
        String content = HttpClientUtil.getInstance()
                .sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
        System.out.println(content);
    }
联系客服,在线咨询