2. Ban Management Module
2.1 Apply to Add Ban
Add new ban records (support both online/offline modes).
Endpoint: POST /bans/add
Request Parameters:
JSON
{
"token": "aBcD1234EfGh5678IjKlMnOpQrSt",
"player_id": "player123",
"ip": "192.168.1.1",
"ipv6": "2001:db8::1",
"online": true,
"mcuuid": "550e8400-e29b-41d4-a716-446655440000"
}
| Parameter | Type | Required | Description |
|---|---|---|---|
| token | string | Yes | Authentication Token (requires upload permission) |
| player_id | string | Conditional | Player identifier (at least one with ip must be provided) |
| ip | string | Conditional | IPv4 address (at least one with player_id must be provided) |
| ipv6 | string | No | IPv6 address |
| online | boolean | No | Data storage mode (true=online, default false=offline) |
| mcuuid | string | No | Minecraft UUID (optional in online mode) |
Request Examples:
cURL - Offline Mode:
Bash
curl -X POST https://api.ndpreforged.com/bans/add \
-H "Content-Type: application/json" \
-d '{
"token": "aBcD1234EfGh5678IjKlMnOpQrSt",
"player_id": "player123",
"ip": "192.168.1.1",
"online": false
}'
cURL - Online Mode:
Bash
curl -X POST https://api.ndpreforged.com/bans/add \
-H "Content-Type: application/json" \
-d '{
"token": "aBcD1234EfGh5678IjKlMnOpQrSt",
"player_id": "player123",
"ip": "192.168.1.1",
"ipv6": "2001:db8::1",
"online": true,
"mcuuid": "550e8400-e29b-41d4-a716-446655440000"
}'
Python:
Python
import requests
response = requests.post(
"https://api.ndpreforged.com/bans/add",
json={
"token": "aBcD1234EfGh5678IjKlMnOpQrSt",
"player_id": "player123",
"ip": "192.168.1.1",
"online": False
}
)
Response Examples:
Success (200 OK):
JSON
{
"message": "Added"
}
Error Responses:
| Status Code | Error Message | Description |
|---|---|---|
| 400 | Missing token | Missing authentication token |
| 400 | Invalid token format | Invalid token format |
| 400 | Token not found | Token does not exist |
| 403 | No permission | No upload permission |
| 400 | Missing player_id or ip | Missing required identifier parameters |
| 400 | Invalid IP format | Invalid IPv4 format |
| 400 | Invalid IPv6 format | Invalid IPv6 format |
| 400 | Invalid MCUUID format | Invalid MCUUID format |
| 400 | Already banned | Offline mode: record already exists |
| 400 | Already exists | Online mode: record already exists |
| 500 | Server error | Server internal error |