接口URL
https://api.polyv.net/live/v3/channel/auth/delete-white-list
接口说明
(接口调用有频率限制,详细请查看)
1、作用:用于删除指定观看白名单(支持一键清空)
2、接口支持https协议
返回结果支持格式
JSON
请求方式
POST
请求数限制
TRUE
请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | string | 当前时间的秒级时间戳(13位) |
sign | 是 | string | 签名,为32位大写的MD5值 |
channelId | 否 | int | 频道号(传频道号则删除频道观看白名单,不传频道号则删除全局观看白名单) |
rank | 是 | int | 主要观看条件为1,次要观看条件为2 |
isClear | 是 | String | 是否一键清空白名单(Y :清空白名单;N:根据code请求白名单,code) |
code | 否 | string | 会员码(isClear 为N时为必传参数) |
操作成功响应示例
{
"code": 200,
"message": "",
"status": "success",
"data": "success"
}
操作失败响应示例
签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
缺少参数
{
"code": 400,
"status": "error"
"message": "param should not be empty: name",
"data": ""
}
参数不是Y/N类型错误
{
"code": 400,
"status": "error"
"message": "param is not boolean (Y / N)",
"data": ""
}
响应字段说明
名称 | 类型 | 说明 |
---|---|---|
code | string | 响应代码,成功为200,失败为400,签名错误为401,异常错误500 |
status | string | 成功为success,失败为error |
message | string | 错误时为错误提示消息 |
data | string | 成功返回信息 |
php请求示例
<?php
//引用config.php
include 'config.php';
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'channelId' => '123456',
'isClear' => 'N',
'code' => '会员码123',
'rank' => '1';
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params["sign"] = $sign;
$url="https://api.polyv.net/live/v3/channel/auth/delete-white-list?".http_build_query($params);
function post($url, $post_data = '', $timeout = 5){
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
if($post_data != ''){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($post_data)));
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}
echo post($url);
?>