保利威文档中心

帮助中心

查询频道观看条件

更新时间:2025-05-27 11:08:57

接口描述

1、查询频道观看条件
2、接口支持https协议

接口URL

http://api.polyv.net/live/v3/channel/auth/get

在线API调用

请求方式

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&timestamp=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 密码观看的二维码提示
qcodeImg String 密码观看的二维码图片
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": ""
}
联系客服,在线咨询