接口URL
https://api.polyv.net/live/v3/channel/chat/get-banned-list
接口说明
获取禁言列表
支持格式
JSON
请求方式
GET
请求参数
参数名 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
sign | true | string | 签名 |
appId | true | string | 开发者账号下的appId |
timestamp | true | string | 13位当前时间的时间戳 |
channelId | true | int32 | 频道号 |
type | true | string | 禁言类型,ip/userId |
toGetSubRooms | false | int | 是否获取子频道,0:不获取,1:获取 |
返回错误结果JSON示例
签名错误:
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
时间戳错误:
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
返回正确结果JSON示例
1、type为userId时,返回禁言用户userId
{
"code": 200,
"status": "success",
"message": "",
"data": [
"1574927917080"
]
}
2、type为ip时,返回禁言列表ip
{
"code": 200,
"status": "success",
"message": "",
"data": [
"59.41.162.172"
]
}
字段说明
字段 | 类型及范围 | 说明 |
---|---|---|
code | int32 | 返回码 |
status | string | 返回状态 |
message | string | 返回信息 |
data | string[] | 操作结果:ip数组或userId数组 |
PHP请求示例
<?php
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$appId = "XXXXXXXX";
$channelId = "127075";
$timestamp = "123123123123";
$type = "ip";
$params = array(
'appId'=>$appId,
'channelId'=>$channelId,
'timestamp'=>$timestamp,
'type'=>$type
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "https://api.polyv.net/live/v3/channel/chat/get-banned-list?appId=$appId&channelId=$channelId&type=$type&sign=$sign×tamp=$timestamp"
$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;
?>