获取直播频道观看条件

接口URL

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

接口说明

1、接口用于获取频道观看条件
2、接口支持https

支持格式

JSON

请求方式

GET

请求数限制

TRUE

请求参数

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

响应成功JSON示例:

带频道ID的查询(频道生效观看条件)

{
  "code": 200,
  "status": "success",
  "message": "",
  "data": [
    {
      "channelId": 102666,
      "rank": 1,
      "userId": "edvf2fpec9",
      "globalSettingEnabled": "N",
      "enabled": "N",
      "authType": "none",
      "authTips": null,
      "payAuthTips": null,
      "authCode": null,
      "qcodeTips": null,
      "qcodeImg": null,
      "price": 0.00,
      "watchEndTime": null,
      "validTimePeriod": null,
      "customKey": "18c9a2e1a1",
      "customUri": null,
      "externalKey": "9828d6d5c7",
      "externalUri": null,
      "externalRedirectUri": null
    },
    {
      "channelId": 102666,
      "rank": 2,
      "userId": "edvf2fpec9",
      "globalSettingEnabled": "N",
      "enabled": "N",
      "authType": "none",
      "authTips": null,
      "payAuthTips": null,
      "authCode": null,
      "qcodeTips": null,
      "qcodeImg": null,
      "price": 0.00,
      "watchEndTime": null,
      "validTimePeriod": null,
      "customKey": "a0c72effe6",
      "customUri": null,
      "externalKey": "d4cebeb205",
      "externalUri": null,
      "externalRedirectUri": null
    }
  ]
}

不带频道ID的查询(全局观看条件)

{
  "code": 200,
  "status": "success",
  "message": "",
  "data": [
    {
      "userId": "edvf2fpec9",
      "rank": 1,
      "enabled": "N",
      "authType": "none",
      "authTips": "欢迎观看本直播",
      "payAuthTips": "欢迎观看本直播",
      "authCode": null,
      "qcodeTips": null,
      "qcodeImg": null,
      "price": 0.00,
      "watchEndTime": null,
      "validTimePeriod": null,
      "customKey": "a0088ec548",
      "customUri": null,
      "externalKey": "5ca1b8cc31",
      "externalUri": null,
      "externalRedirectUri": null
    },
    {
      "userId": "edvf2fpec9",
      "rank": 2,
      "enabled": "N",
      "authType": "none",
      "authTips": "欢迎观看本直播",
      "payAuthTips": "欢迎观看本直播",
      "authCode": null,
      "qcodeTips": null,
      "qcodeImg": null,
      "price": 0.00,
      "watchEndTime": null,
      "validTimePeriod": null,
      "customKey": "8ad66e747e",
      "customUri": null,
      "externalKey": "9c90190d44",
      "externalUri": null,
      "externalRedirectUri": 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 请求结果代码,成功为200 错误为400,签名错误为403,接口错误为500
status 请求结果,成功时为"success"错误时为"error"
message 错误信息,请求成功时为空串,错误时错误信息
data 请求成功为数据内容,错误为空串
channelId 频道ID
userId 用户ID
rank 用于实现一个频道设置两个观看条件,为1或2(1为主要条件,2为次要条件)
globalSettingEnabled 是否开启全局设置(Y/N)
enabled 是否开启观看条件(Y/N)
authType 观看条件类型(1. 无限制 none 2. 验证码观看 code 3. 付费观看 pay 4. 白名单观看 phone 5. 登记观看 info 6. 分享观看 wxshare 7. 自定义授权观看 custom 8. 外部授权观看 external)
authTips 白名单观看提示信息
payAuthTips 付费观看提示信息
authCode 验证码观看的验证码
qcodeTips 验证码观看的二维码提示
qcodeImg 验证码观看的二维码图片
price 付费观看的价格
watchEndTime 付费观看,截止时间,为null表示:一次付费,永久有效
validTimePeriod 付费观看的截止时长 (天)
customKey 自定义授权观看的key
customUri 自定义授权观看的接口地址
externalKey 外部授权观看的key
externalUri 外部授权观看的接口地址
externalRedirectUri 外部授权观看,用户直接访问观看页时的跳转地址

php请求示例

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

$channelId="183950";

$params = array(
  'appId' => $appId,
  'channelId' => $channelId,
  'timestamp' => $timestamp
);

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

$url = "http://api.polyv.net/live/v3/channel/auth/get?appId=".$appId."&channelId=".$channelId."&timestamp=".$timestamp."&sign=".$sign;

echo file_get_contents($url);

?>

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

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

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