保利威文档中心

幫助中心

查詢頻道資訊

更新時間:2026-08-06 23:48:06

舊版介面位址查詢頻道資訊(舊版)

介面說明

1、查询频道基本信息,观看页状态与新版后台一致
2、接口支持https协议

介面URL

http://api.polyv.net/live/v4/channel/basic/get

線上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 頻道號

範例

http://api.polyv.net/live/v4/channel/basic/get?appId=frlr1zazn3&sign=AE9DED64FDDC94A0B18DB29E2D9B7DFC&channelId=3151318&timestamp=1654828588317

回應參數說明

參數名 類型 說明
code Integer 狀態碼,與 HTTP 狀態碼相同,用於確定基本的回應狀態
status String 回應結果,由業務決定,成功回傳 success,失敗回傳 error
success Boolean 是否成功回應
requestId String 請求 ID,每次請求生成的唯一 UUID,僅可用於排查、除錯,不應與業務掛鉤
error Object 狀態碼非 200 時的錯誤資訊【詳見 Error 欄位描述
data Object 【詳見 data 欄位說明

Error 參數說明

參數名 類型 說明
code Integer 錯誤代碼,用於確定具體的錯誤原因
desc String 錯誤描述,與 error.code 對應

data 欄位說明

參數名 類型 說明
channelId String 頻道號
name String 頻道名稱
scene String 直播場景,新版直播不使用該欄位
alone:活動直播
topclass:大班課
ppt:三分屏
seminar:研討會
newScene String 新版後台直播場景,若未定義則取scene
undefined:未定義
topclass:大班課
double:雙師課(需開通權限)
train:企業培訓
seminar:研討會
alone:活動行銷
smallclass(小班課)
template String 新版後台直播模板,若為舊版頻道,該欄位為未定義
undefined:未定義
ppt:三分屏(橫屏)
alone:純影片(橫屏)
topclass:純影片-極速(橫屏)
seminar:研討會
portrait_ppt:三分屏(直式)
portrait_alone:純影片(直式)
channelPasswd String 頻道密碼
publisher String 主持人名稱
startTime Long 直播間設定的直播開始時間(設定後出現倒數計時),未設定直播開始時間或重設了直播開始時間時為0;設定並生效時為13位毫秒級時間戳。
endTime Long 直播間設定的直播結束時間,13位毫秒級時間戳。
pureRtcEnabled String 頻道無延遲直播開關,Y:開啟,N:關閉
newSessionEnabled String 系列直播開關,Y:系列直播,N:一般直播
pageView Integer 頁面累計觀看數
likes Integer 觀看頁按讚數
coverImg String 頻道圖示
splashImg String 引導頁圖片位址
splashEnabled String 引導頁開關
Y:開啟
N:關閉
bgImg String 播放器封面圖片URL
desc String 直播介紹
consultingMenuEnabled String 諮詢提問開關
Y:開啟
N:關閉
maxViewerRestrict String 限制最大線上觀看人數開關
Y:開啟
N:關閉
maxViewer Integer 最大線上觀看人數
watchUrl String 直播觀看位址,例如 https://xxx.live.polyv.cn/watch/xxxx
watchStatus String 觀看頁狀態
live:直播中
playback:回放中
end:已結束
waiting:等待中
unStart:未開始
banpush:已禁播
watchStatusText String 觀看頁狀態描述
userCategory Object 頻道所屬分類的資訊【詳見userCategory欄位說明
authSettings Array 直播觀看條件列表 【詳見authSettings欄位說明
linkMicLimit Integer 頻道連麥人數限制
createdAccountId String 建立者帳號id,為主帳號建立時,回傳主帳號userId
createdAccountEmail String 建立者帳號信箱
createdTime Long 建立時間,13位時間戳
labelData Array 標籤id陣列 【詳見labelData欄位說明
clientAloneTemplateBackgroundUrl String 客戶端模板背景圖URL
liveCdnBackgroundUrl String 影片混流背景圖URL
pushUrl String 推流連結 (僅純影片有值)
pushSecret String 推流金鑰 (僅純影片有值)
streamType String 直播方式. client: 使用開播端或第三方推流(常規); disk: 偽直播;
type String 頻道類型,normal:一般頻道,transmit:發起轉播,receive:接收轉播,transmit_package:發起轉播+包裝,receive_package:接收轉播+包裝
smallClassSizeLimit Integer 小班課班型,值:1,6,12
isRecord String 小班課錄製開關,僅直播場景是小班課時有效,Y:開啟,N:關閉

labelData 欄位說明

參數名 類型 說明
id String 標籤 ID

userCategory 欄位說明

參數名稱 類型 說明
categoryId String 分類ID
categoryName String 分類名稱
userId String POLYV用戶ID,與保利威官網一致,取得路徑:官網->登入->直播(開發設定)
rank Integer 分類的排序值

authSettings 欄位說明

參數名 類型 說明
channelId String 頻道號
rank Integer 頻道直播觀看條件,主要觀看條件為1,次要觀看條件為2
userId String POLYV用戶ID,與保利威官網一致,取得路徑:官網->登入->直播(開發設定)
globalSettingEnabled String 是否開啟全域設定
Y:開啟
N:關閉
enabled String 是否開啟觀看條件
Y:開啟
N:關閉
authType String 觀看條件類型
none:無限制
code:驗證碼觀看
pay:付費觀看
phone:白名單觀看
info:登記觀看
wxshare:分享觀看
custom:自訂授權觀看
external:外部授權觀看
direct:獨立授權
authTips String 白名單觀看提示資訊
payAuthTips String 付費觀看提示資訊
codeAuthTips String 驗證碼觀看條件提示資訊
infoAuthTips String 登記觀看條件提示資訊
authCode String 驗證碼觀看的驗證碼
qcodeTips String 驗證碼觀看的二維碼提示
qcodeImg String 驗證碼觀看的二維碼圖片
price Float 付費觀看的價格
watchEndTime Long 付費觀看截止時間,13位毫秒級時間戳,為 null 表示一次付費,永久有效
validTimePeriod Integer 付費觀看的截止時長,單位為天
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 表示對該頻道永久有效
whiteListInputTips String 白名單輸入提示
whiteListEntryText String 白名單入口文案
infoDesc String 登記觀看描述欄位
customTeacherId String 自訂講師ID
expectedArrivalEnabled String 當authType為phone時使用,到課名單開關,Y:開啟,N:關閉

Java請求示例

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

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

private static final Logger log = LoggerFactory.getLogger(getClass());
/**
 * 查询频道基本信息
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetChannelDetail() 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/v4/channel/basic/get";
    String channelId = "3151318";
    
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", channelId);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询频道基本信息,返回值:{}", response);
    //do somethings
    
}

回應範例

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

成功範例

{
    "code": 200,
    "status": "success",
    "requestId": "4a11f50ed079498bba8d8886b069c5fa.65.16548285928827809",
    "data": {
        "channelId": 3151318,
        "name": "测试频道",
        "scene": "ppt",
        "newScene": "undefined",
        "template": "undefined",
        "channelPasswd": "8YiFH5",
        "publisher": "主持人",
        "startTime": 0,
        "endTime": 1687414806000,
        "newSessionEnabled": "Y",
        "pageView": 1,
        "likes": 0,
        "coverImg": "//liveimages.videocc.net/assets/wimages/pc_images/logo.png",
        "splashImg": "",
        "splashEnabled": "Y",
        "desc": "",
        "consultingMenuEnabled": "Y",
        "maxViewerRestrict": "N",
        "maxViewer": -1,
        "watchUrl": "https://1b448be323.live.polyv.cn/watch/3151318",
        "watchStatus": "unStart",
        "watchStatusText": "未开始",
        "userCategory": {
            "categoryId": 391352,
            "categoryName": "测试频道",
            "userId": "1b448be323",
            "rank": 3619
        },
        "authSettings": [
            {
                "channelId": 3151318,
                "userId": "1b448be323",
                "rank": 1,
                "globalSettingEnabled": "N",
                "enabled": "N",
                "authType": "info",
                "authTips": "欢迎观看本次直播",
                "payAuthTips": "欢迎观看本次直播",
                "codeAuthTips": "欢迎观看本次直播",
                "infoAuthTips": "欢迎观看本次直播",
                "authCode": "",
                "qcodeTips": "",
                "qcodeImg": "",
                "price": 0.00,
                "watchEndTime": null,
                "validTimePeriod": null,
                "customKey": "ujpTIPloEw",
                "customUri": "http://sadboy.cn/polyv.test?a=123&url=ijofdajodfsaoi",
                "externalKey": "ujpTIPloEw",
                "externalUri": "",
                "externalRedirectUri": "",
                "externalEntryText": "",
                "directKey": "ujpTIPloEw",
                "trialWatchEnabled": "N",
                "trialWatchTime": null,
                "trialWatchEndTime": null,
                "whiteListInputTips": "请输入会员码-1605067278063",
                "whiteListEntryText": "会员入口",
                "infoDesc": ""
            },
            {
                "channelId": 3151318,
                "userId": "1b448be323",
                "rank": 2,
                "globalSettingEnabled": "N",
                "enabled": "N",
                "authType": "none",
                "authTips": "欢迎观看本次直播",
                "payAuthTips": "欢迎观看本次直播",
                "codeAuthTips": "欢迎观看本次直播",
                "infoAuthTips": "欢迎观看本次直播",
                "authCode": "",
                "qcodeTips": "",
                "qcodeImg": "",
                "price": 0.00,
                "watchEndTime": null,
                "validTimePeriod": null,
                "customKey": "ujpTIPloEw",
                "customUri": "",
                "externalKey": "ujpTIPloEw",
                "externalUri": "",
                "externalRedirectUri": "",
                "externalEntryText": "",
                "directKey": "ujpTIPloEw",
                "trialWatchEnabled": "N",
                "trialWatchTime": null,
                "trialWatchEndTime": null,
                "whiteListInputTips": "",
                "whiteListEntryText": "会员入口",
                "infoDesc": ""
            }
        ],
        "bgImg": null,
        "onlyOutEnabled": "Y",
        "linkMicLimit": 16,
        "customTeacherId": "polyv001",
        "createdAccountId": "1b448be323",
        "createdAccountEmail": "sdk-demo@polyv.net",
        "createdTime": 1603155366000,
        "labelData":["zpmz3640wkxpj267"]
    },
    "success": true
}

異常範例

{
    "code": 400,
    "status": "error",
    "error": {
        "code": 10003,
        "desc": "时间戳过期"
    },
    "success": false
}
联系客服,在线咨询