保利威文档中心

帮助中心

查询默认模板-观看条件

更新时间: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时使用,验证码公众号二维码,最大长度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
}
联系客服,在线咨询