获取频道观看条件接口

接口URL

https://api.polyv.net/live/v2/channelsetting/{channelId}/watch-auth

接口说明

1、获取频道设置的观看条件
2、channelId为频道ID

支持格式

JSON

请求方式

GET

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp string 当前13位毫秒级时间戳,3分钟内有效
sign string 签名,为32位大写的MD5值

响应成功JSON示例:

{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"channelId": 188194,
"rank": 1,
"userId": "ec7paqepj3",
"globalSettingEnabled": "N",
"authType": "info",
"authTips": "欢迎观看本直播",
"payAuthTips": "欢迎观看本直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 1,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "",
"customUri": null,
"externalKey": "",
"externalUri": null,
"externalRedirectUri": null,
"whiteList": null,
"infoField": {
"channelFieldEnabled1": "N",
"channelFieldName1": "欢迎观看本直播",
"channelFieldPlaceholder1": "ssssss",
"channelFieldType1": "text",
"channelFieldOption1": null,
"channelFieldEnabled2": "N",
"channelFieldName2": "sss",
"channelFieldPlaceholder2": "fff",
"channelFieldType2": "number",
"channelFieldOption2": null,
"channelFieldEnabled3": "N",
"channelFieldName3": "",
"channelFieldPlaceholder3": "",
"channelFieldType3": "",
"channelFieldOption3": "",
"channelFieldEnabled4": "N",
"channelFieldName4": "",
"channelFieldPlaceholder4": "",
"channelFieldType4": "",
"channelFieldOption4": "",
"channelFieldEnabled5": "N",
"channelFieldName5": "",
"channelFieldPlaceholder5": "",
"channelFieldType5": "",
"channelFieldOption5": ""
}
},
{
"channelId": 188194,
"rank": 2,
"userId": "ec7paqepj3",
"globalSettingEnabled": "N",
"authType": "phone",
"authTips": "欢迎观看本直播",
"payAuthTips": "欢迎观看本直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 0,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "",
"customUri": null,
"externalKey": "",
"externalUri": null,
"externalRedirectUri": null,
"whiteList": [
{
"name": "",
"phone": "1",
"isVip": "N"
},
{
"name": "",
"phone": "10",
"isVip": "N"
},
{
"name": "",
"phone": "11",
"isVip": "N"
},
{
"name": "",
"phone": "12",
"isVip": "N"
}
],
"infoFieldModel": null
}
]
}

响应失败JSON示例:

未输入appId

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

appId不正确

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

时间戳错误

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

签名错误

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

字段说明

参数名 说明
code 请求状态响应码
status 请求状态
message 错误信息
data 观看条件相关信息
channelId 频道ID,整型
rank 1为主要观看条件,2位次要观看条件
userId 账号ID,字符串
globalSettingEnabled 是否开启全局设置,Y开启,N没有开启
authType 观看条件类型,none为无限制,code为验证码,phone为手机白名单,pay付费观看,custom自定义授权,info登记观看,external外部授权,wxshare微信分享观看
authTips 提示文案,字符串
payAuthTips 付费观看的提示文案,字符串
authCode 验证码,字符串
qcodeTips 验证码观看的提示文案,字符串
qcodeImg 验证码观看的微信公众二维码,字符串
price 付费观看的价格,字符串
watchEndTime 付费观看的有效时间,13位的时间戳
validTimePeriod 付费观看的有效时间,整型,10表示付费后10天内有效
customKey 自定义授权的key
customUri 自定义授权的url
externalKey 外部授权的key
externalUri 外部授权的url
externalRedirectUri 外部授权的错误的跳转页面地址
whiteList 手机白名单观看的白名单列表
whiteList.name 白名单昵称
whiteList.phone 白名单的手机号
whiteList.isVip 白名单是否VIP
infoField 登记观看的字段信息
infoField.channelFieldEnabled1 字段1是否开启
infoField.channelFieldName1 字段1的字段名称
infoField.channelFieldPlaceholder1 字段1提示语
infoField.channelFieldType1 字段1的类型
infoField.channelFieldOption1 字段1的下拉内容

php请求示例

<?php

//引用config.php
include 'config.php';

$channelId = "127075";
/接口需要的参数(非sign)赋值
$params = array(
    'appId'=>$appId,
    'timestamp'=>$timestamp
  );

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法

//接口请求url
$url = "http://api.live.polyv.net/v2/channelsetting/127075/watch-auth?appId=".$appId."&timestamp=".$timestamp."&sign=".$sign;
//输出接口请求结果
echo file_get_contents($url);

?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...