2.3.1 Download Ban Data
Get temporary download link for ban database.
Endpoint: GET /bans/download?token={token}
Request Example:
Bash
curl "https://api.ndpreforged.com/bans/download?token=aBcD1234EfGh5678IjKlMnOpQrSt"
Python Request Example:
Python
import requests
# Get download URL
response = requests.get(
"https://api.ndpreforged.com/bans/download",
params={"token": "aBcD1234EfGh5678IjKlMnOpQrSt"}
)
data = response.json()
download_url = data['url']
# Download database file
download_response = requests.get(download_url)
with open("bans.db", "wb") as f:
f.write(download_response.content)
Success Response (200):
JSON
{
"url": "http://localhost:8001/AbCd1234EfGh5678_database.db"
}
Error Responses:
| Status Code | Response Content | Description |
|---|---|---|
| 400 | {"error": "Missing token"} | Missing token |
| 400 | {"error": "Invalid token format"} | Invalid token format |
| 400 | {"error": "Token not found"} | Token does not exist |
| 500 | {"error": "Failed to pack database"} | Failed to pack database |
| 500 | {"error": "Failed to get download URL"} | Failed to get download URL |
| 500 | {"error": "Server error"} | Server error |
2.3.2 Complete Download Cleanup
Notify server that download is complete, trigger temporary file cleanup process.
Endpoint: POST /bans/download/done
Request Parameters:
JSON
{
"token": "aBcD1234EfGh5678IjKlMnOpQrSt"
}
Request Example:
Bash
curl -X POST https://api.ndpreforged.com/bans/download/done \
-H "Content-Type: application/json" \
-d '{
"token": "aBcD1234EfGh5678IjKlMnOpQrSt"
}'
Success Response (200):
JSON
{
"message": "Download completed"
}
Error Responses:
| Status Code | Response Content | Description |
|---|---|---|
| 400 | {"error": "Missing token"} | Missing token |
| 400 | {"error": "Invalid token format"} | Invalid token format |
| 400 | {"error": "Session not found"} | Session does not exist |
| 500 | {"error": "Failed to delete temp file"} | Failed to delete temporary file |
| 500 | {"error": "Server error"} | Server error |
Notes: