查询频道观看条件
接口描述
1、查询频道观看条件
2、接口支持https协议
接口URL
http://api.polyv.net/live/v3/channel/auth/get
请求方式
GET
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
示例
http://api.polyv.net/live/v3/channel/auth/get?appId=frlr1zazn3&sign=8661982EB3646269F9824A6ACCACE25C×tamp=1621843737789
响应参数描述
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
验证码观看的验证码
qcodeTips
String
验证码观看的二维码提示
qcodeImg
String
验证码观看的二维码图片
payAuthTips
String
付费观看提示信息
price
Float
付费观看的价格,单位:元
watchEndTime
Long
付费观看,截止时间,为null表示:一次付费,永久有效
validTimePeriod
Integer
付费观看的截止时长(天)
customKey
String
自定义授权观看的key
customUri
String
自定义授权观看的接口地址
externalKey
String
外部授权观看的key
externalUri
String
外部授权观看的接口地址
externalRedirectUri
String
外部授权观看,用户直接访问观看页时的跳转地址
externalButtonEnabled
String
外部授权观看,登录按钮。Y为开启,N为关闭。开启后用户访问链接时,引导页面将显示登录按钮
directKey
String
独立授权key
trialWatchEnabled
String
付费观看的试看开关,默认为N Y:开 N:关
trialWatchTime
Integer
试看时间,单位为分钟
trialWatchEndTime
Long
试看截止日期,为null 表示对该频道永久有效
whiteListInputTips
String
白名单输入提示
whiteListEntryText
String
白名单入口文案
onceWhitelistEnabled
String
白名单不允许重复使用,默认为N,Y:是、N:否
authTips
String
白名单观看提示信息
infoDesc
String
登记观看描述字段
infoAuthTips
String
登记观看条件提示信息
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": ""
}
Last updated
Was this helpful?