WebAPI - MazeXD/cuwo GitHub Wiki
##Features
- List online players
- Get details of a specific player (level, skills, equipment, ...)
- Kick players
- Get/Set ingame time
- Send a global message
- Send a message to a specific player
##Configuration
| Setting Type | Setting | Description |
|---|---|---|
| int | webapi_port | Port WebAPI is running on |
| string[] | webapi_keys | Keys which are allowed to access WebAPI |
##Usage
The base endpoint is http://{Address of cuwo host}:{webapi_port}/.
Each request requires a valid key!
Each response is json formatted.
Example
Request:
http://127.0.0.1:12350/player/?key=w4b341g6184e9rg
Response:{"players": [{"name": "MazeXD", "id": 1}, {"name": "Xharon", "id": 2}]}
##Endpoints
| Endpoint | Method | Description | Extra |
|---|---|---|---|
| / | GET | Returns version of WebAPI | |
| /status/ | GET | Returns (seed, players, limit) | |
| /player/ | GET | Returns list of players with IDs | |
| /player/{name}/ | GET | Return details about a player | append &include={inclusion} inclusion supports skills, equipment e.g. skills or skills,equipment |
| /kick/{name}/ | GET | Kicks the player | |
| /time/ | GET | Returns ingame time | |
| /time/{time}/ | GET | Sets ingame time | {time} must match the time format %H:%M (eg. 13:43) |
| /message/ | POST | Sends post data as global message | |
| /message/{name}/ | POST | Sends post data to player |
##Error Codes
| Code | Meaning |
|---|---|
| -1 | UNAUTHORIZED |
| -2 | INVALID_RESOURCE |
| -3 | INVALID_PLAYER |
| -4 | INVALID_TIME |
| -5 | INVALID_METHOD |
SDKs
| Language | Link |
|---|---|
| Python | https://github.com/MazeXD/cuwo/blob/feature-webapi/webapi-sdk/python/webapi.py |
| PHP | https://github.com/MazeXD/cuwo/blob/feature-webapi/webapi-sdk/php/webapi.php |