保利威文档中心

幫助中心

查詢頻道資訊

更新時間:2022-09-02 18:08:07

介面描述

1、查询频道基本信息
2、接口支持https协议

介面URL

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

線上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/v3/channel/basic/get-channel?appId=frlr1zazn3&sign=4049473DAEBBEFF778DABD1A25E3409B&channelId=2779045&timestamp=1642732753732

回應參數描述

參數名 類型 說明
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:文件+影片
alone:純影片(專業)
topclass:純影片(極速)
seminar:研討會
portrait_ppt:文件+影片(直式)
portrait_alone:影片(直式)
channelPasswd String 頻道密碼
publisher String 主持人名稱
startTime Long 直播間設定的直播開始時間(設定後出現倒數計時),未設定直播開始時間或重設了直播開始時間時為0;設定並生效時為13位毫秒級時間戳記。
pageView Integer 頁面累計觀看數
likes Integer 觀看頁按讚數
coverImg String 播放器封面url
splashImg String 直播間封面url
splashEnabled String 引導頁開關
Y:開啟
N:關閉
desc String 直播介紹
consultingMenuEnabled String 諮詢提問開關
Y:開啟
N:關閉
maxViewerRestrict String 限制最大線上觀看人數開關
Y:開啟
N:關閉
maxViewer Integer 最大線上觀看人數
watchStatus String 觀看頁狀態
live:直播中
playback:回放中
end:已結束
waiting:等待中
unStart:未開始
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 testGetChannel() 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-channel";
    String channelId = "2779045";
    
    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": 2779045,
        "name": "测试",
        "scene": "alone",
        "newScene": "alone",
        "template": "portrait_alone",
        "channelPasswd": "6dMuVz",
        "publisher": "主持人",
        "startTime": 0,
        "pageView": 6,
        "likes": 0,
        "coverImg": "//liveimages.videocc.net/assets/wimages/pc_images/logo.png",
        "splashImg": "//liveimages.videocc.net/uploaded/images/2021/09/g2bta2pjbw.jpg",
        "splashEnabled": "Y",
        "desc": "",
        "consultingMenuEnabled": "Y",
        "maxViewerRestrict": "N",
        "maxViewer": -1,
        "watchStatus": "unStart",
        "watchStatusText": "未开始",
        "userCategory": {
            "categoryId": 340019,
            "categoryName": "默认分类",
            "userId": "1b448be323",
            "rank": 0
        },
        "authSettings": [
            {
                "channelId": 2779045,
                "rank": 1,
                "userId": "1b448be323",
                "globalSettingEnabled": "N",
                "enabled": "N",
                "authType": "external",
                "authTips": "欢迎观看本次直播",
                "payAuthTips": "欢迎观看本次直播",
                "codeAuthTips": "欢迎观看本次直播",
                "infoAuthTips": "欢迎观看本次直播",
                "authCode": "",
                "qcodeTips": null,
                "qcodeImg": null,
                "price": 0.01,
                "watchEndTime": null,
                "validTimePeriod": null,
                "customKey": "ujpTIPloEw",
                "customUri": "",
                "externalKey": "ujpTIPloEw",
                "externalUri": "http://www.polyv.net",
                "externalRedirectUri": "",
                "externalEntryText": "登录观看",
                "directKey": "ujpTIPloEw",
                "trialWatchEnabled": "N",
                "trialWatchTime": 1,
                "trialWatchEndTime": null,
                "whiteListInputTips": "请输入会员码-1605067278063",
                "whiteListEntryText": "会员入口",
                "infoDesc": ""
            },
            {
                "channelId": 2779045,
                "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": "ujpTIPloEw",
                "customUri": null,
                "externalKey": "ujpTIPloEw",
                "externalUri": null,
                "externalRedirectUri": null,
                "externalEntryText": "",
                "directKey": "ujpTIPloEw",
                "trialWatchEnabled": "N",
                "trialWatchTime": null,
                "trialWatchEndTime": null,
                "whiteListInputTips": null,
                "whiteListEntryText": "会员入口",
                "infoDesc": null
            }
        ],
        "bgImg": "",
        "creatorChildId": null,
        "creatorName": null,
        "onlyOutEnabled": "Y"
    }
}

異常範例

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