POST /banip/{ip}
端点: POST /v1/pdapi/banip/<ip>
认证: Bearer 令牌
权限: REST.Punishments.BanIP
用途
封禁 IP 地址并记录到 Banlist.json。
路径参数
ip: IP address to ban.
查询参数
无。
请求体
可选 JSON 字段:字符串 Reason;如果此 IP 封禁应关联到某个用户,也可提供字符串 UserId。
响应结构
200 response schema
| Field | Type | Description |
|---|---|---|
Success |
boolean | true when the IP ban was recorded. |
IP |
string | IP address that was banned. |
UserId |
string | Optional user ID recorded with the IP ban. |
Kicked |
integer | Number of online players kicked from that IP address. |
错误响应
错误响应使用以下格式:
| HTTP | 错误代码 | 发生条件 |
|---|---|---|
401 |
INVALID_TOKEN |
Authorization 头缺失、格式错误,或与配置的 Bearer 令牌不匹配。 |
403 |
MISSING_PERMISSION |
令牌有效,但不包含此端点权限。 |
400 |
INVALID_JSON |
提供了请求体,但无法解析为 JSON。 |
400 |
REQUEST_FAILED |
游戏线程回调抛出异常,或共享玩家/资源解析器失败。 |
500 |
REQUEST_TIMEOUT |
内部游戏线程回调未在 5 秒内完成。 |
400 |
VALIDATION_FAILED |
An optional request field has the wrong JSON type. |
示例
Ban an IP only
Ban an IP and attach a GDK user
使用场景
- Stop repeated abuse from the same IP after staff review.
- Associate
UserIdwhen known so the banlist is easier to audit. - 使用带
ip的 GET /banlist 验证活动记录。