撤销禁言IP/严禁词

接口URL

http://api.polyv.net/live/v2/chat/{channelId}/delBanned

接口说明

1、取消被禁言的ip或者删除严禁词,其返回结果为当前频道号被禁言ip列表或者严禁词名单,注:如删除失败,则返回的结果与接口"获得禁言IP/严禁词列表"内容相同
2、接口支持https协议
3、接口URL中的{channelId}为 频道ID

支持格式

JSON

请求方式

GET,POST

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
type string 请求类型:ip(取消已禁言IP),badword(删除严禁词)
content string 要取消的ip或者严禁词
appId string 从API设置中获取,在直播系统登记的appId
timestamp string 当前13位毫秒级时间戳,3分钟内有效
sign string 签名,32位大写MD5值

响应成功JSON示例:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": "123.123.12.1,192.168.1.123"
}

响应失败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": ""
}

类型输入错误

{
    "code": 400,
    "status": "error",
    "message": "type is wrong.",
    "data": ""
}

content输入错误

{
    "code": 400,
    "status": "error",
    "message": "输入错误,请重试.",
    "data": ""
}

其他错误

{
    "code": 400,
    "status": "error",
    "message": "无法访问聊天室数据",
    "data": ""
}

字段说明

参数名 说明
code 请求状态响应码
status 请求状态
message 错误信息
data 已禁言名单或严禁词名单

php请求示例

<?php

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

//接口需要的参数(非sign)赋值
$channelId = "137720";
$type = "ip";
$content = "192.168.1.2";

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

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

$data = array(
    'appId' => $appId,
    'content' => $content,
    'timestamp' => $timestamp,
    'type' => $type,
    'sign' => $sign,
);

$url = "http://api.live.polyv.net/v2/chat/$channelId/delBanned";
$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $data);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$reponse = curl_exec ( $ch );
curl_close ( $ch );
print_r($reponse);

?>

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

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

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