查詢頻道觀看條件
更新時間:2025-05-27 11:08:57
介面描述
1、查询频道观看条件
2、接口支持https协议
介面URL
http://api.polyv.net/live/v3/channel/auth/get
請求方式
GET
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS以確保介面安全,介面呼叫有頻率限制,詳細請查看
請求參數描述
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | true | String | 帳號appId【詳見取得金鑰】 |
| timestamp | true | Long | 目前13位毫秒級時間戳記,3分鐘內有效 |
| sign | true | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| channelId | false | String | 頻道號,不傳為全域檢視 |
範例
http://api.polyv.net/live/v3/channel/auth/get?appId=frlr1zazn3&sign=8661982EB3646269F9824A6ACCACE25C×tamp=1621843737789
回應參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明】 |
| status | String | 回應狀態文字資訊 |
| message | String | 回應描述資訊,當code為400或500時,輔助描述錯誤原因 |
| data | Array | 請求成功為資料內容,錯誤為空字串 【詳見data欄位說明】 |
data欄位說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| channelId | String | 頻道號 |
| userId | String | 使用者ID |
| rank | Integer | 用於實現一個頻道設定兩個觀看條件,為1或2(1為主要條件,2為次要條件) |
| globalSettingEnabled | String | 是否開啟全域設定(該值僅對舊版後台有效) Y:開啟 N:不開啟 |
| enabled | String | 是否開啟觀看條件 Y:開啟 N:不開啟 開關開啟時對應觀看條件才生效。主要觀看條件未開啟時,次要觀看條件同樣不生效 |
| authType | String | 觀看條件類型 none:無限制 code:密碼觀看 pay:付費觀看 phone:白名單觀看 info:登記觀看 wxshare:分享觀看 custom:自訂授權觀看 external:外部授權觀看 direct:獨立授權) |
| subAuthType | String | authType為none時對應的值,public-公開觀看,wx-微信授權 |
| wxAuthExpireValue | String | subAuthType為wx時,對應的微信授權有效期,例如: 3d表示3天,3h表示3小時 |
| codeAuthTips | String | 密碼觀看條件提示資訊 |
| authCode | String | 密碼觀看的驗證碼 |
| codeEntryText | String | 密碼觀看入口文字 |
| qcodeTips | String | 密碼觀看的QR Code提示 |
| qcodeImg | String | 密碼觀看的QR Code圖片 |
| payAuthTips | String | 付費觀看提示資訊 |
| price | Float | 付費觀看的價格,單位:元 |
| watchEndTime | Long | 付費觀看,截止時間,為null表示:一次付費,永久有效 |
| validTimePeriod | Integer | 付費觀看的截止時長(天) |
| customKey | String | 自訂授權觀看的key |
| customUri | String | 自訂授權觀看的介面地址 |
| customEntryText | String | 自訂授權入口文字 |
| externalKey | String | 外部授權觀看的key |
| externalUri | String | 外部授權觀看的介面地址 |
| externalRedirectUri | String | 外部授權觀看,使用者直接造訪觀看頁時的跳轉地址 |
| externalEntryText | String | 外部授權觀看,入口文字 |
| externalButtonEnabled | String | 外部授權觀看,登入按鈕。Y為開啟,N為關閉。開啟後使用者造訪連結時,引導頁面將顯示登入按鈕 |
| directKey | String | 獨立授權key |
| trialWatchEnabled | String | 付費觀看的試看開關,預設為N Y:開 N:關 |
| trialWatchTime | Integer | 試看時間,單位為分鐘 |
| trialWatchEndTime | Long | 試看截止日期,為null 表示對該頻道永久有效 |
| payEntryText | String | 付費入口文字 |
| whiteListInputTips | String | 白名單觀看輸入提示 |
| whiteListEntryText | String | 白名單觀看入口文案 |
| expectedArrivalEnabled | String | 白名單觀看到勤名單開關,Y-開, N-關,預設為N |
| onceWhitelistEnabled | String | 白名單觀看不允許重複使用,預設為N,Y:是、N:否 |
| authTips | String | 白名單觀看提示資訊 |
| privacyStatus | String | 是否開啟隱私聲明,Y-開, N-關,預設為N |
| privacyContent | String | 隱私聲明內容 |
| infoDesc | String | 登記觀看描述欄位 |
| infoAuthTips | String | 登記觀看條件提示資訊 |
| infoFields | InfoFields | 登記觀看欄位資訊【詳見InfoFields欄位說明】,最多5個 |
| infoEntryText | String | 登記觀看入口文字 |
| inviteWatchAuditEnabled | String | 邀請觀看審核開關,Y-開, N-關,預設為N |
InfoFields欄位說明
| 參數名 | 必填 | 類型 | 說明 |
|---|---|---|---|
| type | true | String | 資訊類型: text-文字,number-數字,option-下拉選單,name-姓名,mobile-手機號碼 |
| name | true | String | 資訊標題,最大長度20 |
| options | false | String | 下拉選單,多個用英文逗號隔開,最多50個,每個選項長度最大30,type為option時選項值 |
| placeholder | false | String | 資訊描述,最大長度50 |
| sms | false | String | 簡訊驗證開關: Y-開, N-關,預設為N |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼, 點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。
強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK 對API呼叫邏輯、例外處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
private static final Logger log = LoggerFactory.getLogger(WatchConditionTest.class);
/**
* 查询频道观看条件
* @throws IOException
*/
@Test
public void testGetWatchCondition() 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/auth/get";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
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": 2191532,
"rank": 1,
"userId": "1b448be323",
"globalSettingEnabled": "N",
"enabled": "Y",
"authType": "custom",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 0.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "6mu6166v4l",
"customUri": "http://mywebsite.com/myDefinedUrl.php",
"externalKey": "w5885oc72o",
"externalUri": "http://mywebsite.com/myDefinedUrl.php",
"externalRedirectUri": null,
"externalButtonEnabled": "N",
"directKey": "te1d5z8cvv",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": null,
"whiteListEntryText": "会员入口",
"infoDesc": null
}, {
"channelId": 2191532,
"rank": 2,
"userId": "1b448be323",
"globalSettingEnabled": "N",
"enabled": "N",
"authType": "none",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 0.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "6mu6166v4l",
"customUri": null,
"externalKey": "w5885oc72o",
"externalUri": null,
"externalRedirectUri": null,
"externalButtonEnabled": "N",
"directKey": "te1d5z8cvv",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": null,
"whiteListEntryText": "会员入口",
"infoDesc": null
}]
}
異常範例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
