保利威文档中心

幫助中心

查詢預設模板-觀看條件

更新時間:2024-09-02 09:58:44

介面描述

1、查询默认模板-观看条件
2、接口支持https协议

介面URL

http://api.polyv.net/live/v4/global/auth/get

線上API呼叫

請求方式

GET

介面限制

1、介面同時支援HTTP、HTTPS,建議使用HTTPS確保介面安全,介面呼叫有頻率限制,詳細請查看

請求參數描述

參數名 必選 類型 說明
appId true String 帳號appId【詳見取得金鑰
sign true String 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則
timestamp true String 當前13位毫秒級時間戳,3分鐘內有效

範例

http://api.polyv.net/live/v4/global/auth/get?appId=frlr1zazn3&sign=7E5AFF654E8CF7960F94D81EC9A516AC&timestamp=1680493605309

回應參數描述

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

Data參數描述

參數名 類型 說明
authEnabled String 授權開關,Y:開啟,N:關閉
authType String 授權類型
none:無限制
code:驗證碼觀看
pay:付費觀看
phone:白名單觀看
info:登記觀看
custom:自訂授權觀看
external:外部授權觀看
direct:獨立授權觀看
subAuthType String authType為none時對應的值,public-公開觀看,wx-微信授權
whiteListEntryText String 當authType為phone時使用,白名單入口文字,最大長度64
whiteListInputTips String 當authType為phone時使用,白名單輸入提示,最大長度64
authTips String 當authType為phone時使用,白名單歡迎標題,最大長度64
payAuthTips String 當authType為pay時使用,付費觀看歡迎標題,最大長度64
price Float 當authType為pay時使用,觀看價格
trialWatchEnabled String 當authType為pay時使用,允許試看開關
trialWatchEndTime String 當authType為pay時使用,試看結束時間
trialWatchTime Integer 當authType為pay時使用,試看時長,單位分鐘
validTimePeriod Integer 當authType為pay時使用,觀看有效時長
watchEndTime String 當authType為pay時使用,觀看結束時間
authCode String 當authType為code時使用,驗證碼,最大長度64
codeAuthTips String 當authType為code時使用,驗證碼歡迎標題,最大長度64
qcodeImg String 當authType為code時使用,驗證碼公眾號QR Code,最大長度256
qcodeTips String 當authType為code時使用,驗證碼提示文案,最大長度256
infoAuthTips String 當authType為info時使用,登記觀看歡迎標題,最大長度64
infoDesc String 當authType為info時使用,登記觀看提示資訊,最大長度64
infoFields Array 當authType為info時使用,登記觀看資訊,最多10條【詳見InfoFields參數描述
customKey String 當authType為custom時使用,自訂授權Key,最大長度64
customUri String 當authType為custom時使用,自訂授權Url,最大長度128
externalEntryText String 當authType為external時使用,外部授權入口文字,最大長度24
externalKey String 當authType為external時使用,外部授權Key,最大長度64
externalRedirectUri String 當authType為external時使用,外部授權調整Url,最大長度350
externalUri String 當authType為external時使用,外部授權Url,最大長度128
directKey String 當authType為direct時使用,獨立授權Key,最大長度64
privacyParam Array 當authType為code、phone、info時使用,隱私聲明資料,[{"authType":"phone" , "status":"Y" , "content":"隱私聲明"}]【詳見PrivacyParam參數描述
expectedArrivalEnabled String 當authType為phone時使用,到課名單開關,Y:開啟,N:關閉
onceWhitelistEnabled String 白名單不允許重複使用,預設為N,Y:是、N:否

PrivacyParam參數描述

參數名 類型 說明
authType String 授權類型
code:驗證碼觀看
pay:付費觀看
phone:白名單觀看
info:登記觀看
custom:自訂授權觀看
external:外部授權觀看
direct:獨立授權觀看
channelId Integer 頻道號
content String 隱私聲明內容
status String 隱私聲明開關,Y:開啟,N:關閉

InfoFields參數描述

參數名 類型 說明
name String 資訊標題
options String 選項
placeholder String 資訊描述
smsEnabled String 簡訊驗證,Y:開啟,N:關閉
type String 類型,
name:姓名,
text:文字,
mobile:手機號碼,
number:數字,
option:下拉選項

Error參數描述

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

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 authGetTest() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());

    //业务参数
    String url = "http://api.polyv.net/live/v4/global/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",
    "requestId": "def302387cab4451ad9258639feaa15c.6086.16804937190327583",
    "data": [
        {
            "authType": "custom",
            "authEnabled": "Y",
            "payAuthTips": null,
            "price": null,
            "trialWatchEnabled": null,
            "trialWatchEndTime": null,
            "trialWatchTime": null,
            "validTimePeriod": null,
            "watchEndTime": null,
            "authTips": null,
            "whiteListEntryText": null,
            "whiteListInputTips": null,
            "infoAuthTips": null,
            "infoDesc": null,
            "infoFields": [],
            "authCode": null,
            "codeAuthTips": null,
            "qcodeImg": null,
            "qcodeTips": null,
            "customKey": "122112121212",
            "customUri": "http://baidu.com",
            "externalKey": null,
            "externalUri": null,
            "externalRedirectUri": null,
            "externalEntryText": null,
            "directKey": null,
            "privacyParam": null
        },
        {
            "authType": "phone",
            "authEnabled": "Y",
            "payAuthTips": null,
            "price": null,
            "trialWatchEnabled": null,
            "trialWatchEndTime": null,
            "trialWatchTime": null,
            "validTimePeriod": null,
            "watchEndTime": null,
            "authTips": "123",
            "whiteListEntryText": "白名单入口文本",
            "whiteListInputTips": null,
            "infoAuthTips": null,
            "infoDesc": null,
            "infoFields": [],
            "authCode": null,
            "codeAuthTips": null,
            "qcodeImg": null,
            "qcodeTips": null,
            "customKey": null,
            "customUri": null,
            "externalKey": null,
            "externalUri": null,
            "externalRedirectUri": null,
            "externalEntryText": null,
            "directKey": null,
            "privacyParam": [
                {
                    "channelId": null,
                    "authType": "phone",
                    "status": "Y",
                    "content": "隐私声明数据"
                }
            ]
        }
    ],
    "success": true
}

異常範例

{
    "code": 400,
    "status": "error",
    "requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
    "error": {
        "code": 20001,
        "desc": "application not found."
    },
    "success": false
}
联系客服,在线咨询