文章目录
接口URL
http://api.polyv.net/live/v2/channelSetting/{channelId}/set-auth-type
接口说明
(接口调用有频率限制,详细请查看)
1、通过接口可以设置频道的观看条件
2、接口支持https
3、接口URL中的{channelId}为 频道ID
注意:目前仅可通过此接口设置为无条件观看
返回结果支持格式
JSON
请求方式
GET,POST
请求数限制
TRUE
请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | string | 当前13位毫秒级时间戳,3分钟内有效 |
authType | 是 | 目前固定取值为none | 观看条件类型 |
sign | 是 | string | 签名,32位大写MD5值 |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": "修改成功"
}
响应失败JSON示例:
未输入appId
{
"code": 400,
"status": "error",
"message": "appId not found.",
"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": 400,
"status": "error",
"message": "channel not found.",
"data": ""
}
authType值错误
{
"code": 400,
"status": "error",
"message": "authType is error",
"data": ""
}
其他情况
{
"code": 400,
"status": "error",
"message": "修改失败",
"data": ""
}
字段说明
参数名 | 说明 |
---|---|
code | 请求结果代码,成功为200 |
status | 请求结果,成功时为"success"错误时为"error" |
message | 错误信息,请求成功时为空,错误时错误信息 |
php请求示例
<?php
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$channelId = "127075";
$authType = "none";
$params = array(
'appId'=>$appId,
'authType'=>$authType,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
//接口请求url
$url = "http://api.polyv.net/live/v2/channelSetting/$channelId/set-auth-type?appId=$appId×tamp=$timestamp&sign=$sign&authType=$authType";
//输出接口请求结果
echo file_get_contents($url);
?>