查詢頻道資訊
更新時間:2025-12-04 13:53:36
介面描述
1、查询频道基本信息
2、接口支持https协议
介面URL
http://api.polyv.net/live/v3/channel/basic/get
請求方式
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/v3/channel/basic/get?appId=frlr1zazn3&sign=A80D0E7115D0D1BF5648AE2AB123C0FD&channelId=1958888×tamp=1621839827266
回應參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明】 |
| status | String | 回應狀態文字資訊 |
| message | String | 回應描述資訊,當code為400或500時,輔助描述錯誤原因 |
| data | Object | 請求失敗時為空,請求成功時為頻道的詳細設定資訊 【詳見data欄位說明】 |
data欄位說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| channelId | String | 頻道號 |
| name | String | 頻道名稱 |
| scene | String | 直播場景,新版直播不使用該欄位 alone:活動直播 topclass:大班課 ppt:三分屏 seminar:研討會 |
| newScene | String | 新版後台直播場景,若未定義則取scene undefined:未定義 topclass:大班課 double:雙師課(需開通權限) train:企業培訓 seminar:研討會 alone:活動行銷 |
| template | String | 新版後台直播模板,若為老版頻道,該欄位為未定義 undefined:未定義 ppt-三分屏(橫屏) portrait_ppt-三分屏(豎屏) alone-純影片(橫屏) portrait_alone-純影片(豎屏) topclass-純影片-極速(橫屏) portrait_topclass-純影片-極速(豎屏) seminar-研討會 |
| channelPasswd | String | 頻道密碼 |
| publisher | String | 主持人名稱 |
| startTime | Long | 直播間設定的直播開始時間(設定後出現倒數計時),未設定直播開始時間或重設了直播開始時間時為0;設定並生效時為13位毫秒級時間戳。 |
| pageView | Integer | 頁面累計觀看數 |
| likes | Integer | 觀看頁按讚數 |
| coverImg | String | 播放器封面url |
| splashImg | String | 直播間封面url |
| splashEnabled | String | 引導頁開關 Y:開啟 N:關閉 |
| desc | String | 直播介紹 |
| pureRtcEnabled | String | 無延遲開關 Y:開啟 N:關閉 |
| consultingMenuEnabled | String | 諮詢提問開關 Y:開啟 N:關閉 |
| maxViewerRestrict | String | 限制最大線上觀看人數開關 Y:開啟 N:關閉 |
| maxViewer | Integer | 最大線上觀看人數,0和-1表示不限制 |
| watchUrl | String | 直播觀看地址,例如 https://xxx.live.polyv.cn/watch/xxxx |
| watchStatus | String | 觀看頁狀態 live:直播中 playback:回放中 end:已結束 waiting:等待中 |
| watchStatusText | String | 觀看頁狀態描述 |
| userCategory | Object | 頻道所屬分類的資訊【詳見userCategory欄位說明】 |
| authSettings | Array | 直播觀看條件列表 【詳見authSettings欄位說明】 |
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 | 驗證碼觀看的QR Code提示 |
| qcodeImg | String | 驗證碼觀看的QR Code圖片 |
| 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 | 登記觀看描述欄位 |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼, 點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。
強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK 對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 查询频道基本信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetChannelDetailSetting() 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/basic/get";
String channelId = "2139283";
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",
"message": "",
"data": {
"channelId": 1958888,
"name": "Junit测试(勿删)888",
"scene": "alone",
"channelPasswd": "xxxxxx",
"pureRtcEnabled":"N",
"publisher": "sadboy主讲",
"startTime": 0,
"pageView": 1000,
"likes": 2000,
"coverImg": "//liveimages.videocc.net/uploaded/images/2021/03/fx6955h3q6.net",
"splashImg": null,
"splashEnabled": "N",
"desc": "这是一个描述",
"consultingMenuEnabled": "Y",
"maxViewerRestrict": "N",
"maxViewer": 0,
"watchUrl": "https://1b448be323.live.polyv.cn/watch/1958888",
"watchStatus": "end",
"watchStatusText": "已结束",
"userCategory": {
"categoryId": 340019,
"categoryName": "默认分类",
"userId": "1b448be323",
"rank": 0
},
"authSettings": [
{
"channelId": 1958888,
"rank": 1,
"userId": "1b448be323",
"globalSettingEnabled": "N",
"enabled": "Y",
"authType": "pay",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": "xxxx",
"qcodeTips": "提示文案",
"qcodeImg": "//liveimages.videocc.net/uploaded/images/2021/03/fx69556szv.png",
"price": 0.01,
"watchEndTime": 1617077460000,
"validTimePeriod": null,
"customKey": "xxxxgn",
"customUri": null,
"externalKey": "xxxxxxxx",
"externalUri": null,
"externalRedirectUri": null,
"directKey": "xxxxxxxx",
"trialWatchEnabled": "Y",
"trialWatchTime": 3,
"trialWatchEndTime": 1617119999000,
"whiteListInputTips": null,
"whiteListEntryText": "会员入口",
"infoDesc": null
},
{
"channelId": 1958888,
"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": "xxxxxxxx",
"customUri": null,
"externalKey": "xxxxxxxx",
"externalUri": null,
"externalRedirectUri": null,
"directKey": "xxxxxxxx",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": null,
"whiteListEntryText": "会员入口",
"infoDesc": null
}
],
"bgImg": "https://car3.autoimg.cn/cardfs/product/g25/M08/C7/57/1024x0_1_q95_autohomecar__ChsEmF8EOK-AB5uaAAfsj_iwPdE906.jpg",
"creatorChildId": null,
"creatorName": null
}
}
異常範例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
