#Wurm REST API
RESTful API for the Wurm Server
**Version** 0.1-SNAPSHOT
[**Apache 2.0**](http://www.apache.org/licenses/LICENSE-2.0.html)
# APIs
Details of each set of API calls is below. Each entry outlines the method, path and the form of
the results that is returned. The use of `{variableName}` in the path indicates that a variable is
expected to be substituted. For example, when requesting the Bank balance of a player, the
required path is:
`/players/{player}/money`
So for player named `Oliver`, the required path is:
`/players/Oliver/money`
On failure of the Wurm interface call, the interface returns the following, where `message` is a
descriptive message that may vary depending on what error has been encountered:
**Status Code:** `504 GATEWAY_TIMEOUT`
**Response:**
```json
{
"code": 504,
"message": "Could not create stub for web interface"
}
```
## /players
### GET
Players in the server cluster
All players known to the server cluster. The filter parameter may be specified to retrieve the total count (filter=total)
#### Request
**Content-Type: ** application/json
##### Parameters
Name |
Located in |
Required |
Description |
Default |
Schema |
filter |
query |
no |
|
- |
string |
#### Response
**Content-Type: ** application/json
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
| 200 | successful operation | Players|
## /players/{player}/money
### GET
Retrieve the value for a player
Returns an error if the player cannot be found
#### Request
**Content-Type: ** application/json
##### Parameters
Name |
Located in |
Required |
Description |
Default |
Schema |
player |
path |
yes |
|
- |
string |
#### Response
**Content-Type: ** application/json
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
| 200 | successful operation | Balance|
### POST
Add money to or remove money from a player's bank account
Returns a message indicating the result of the transaction
#### Request
**Content-Type: ** application/json
##### Parameters
Name |
Located in |
Required |
Description |
Default |
Schema |
player |
path |
yes |
|
- |
string |
#### Response
**Content-Type: ** application/json
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
| 200 | successful operation | Result|
## /server/broadcast
### POST
Broadcasts an announcement to the server
Returns a result with a boolean with value true if the broadcast was successful, otherwise an error
#### Request
**Content-Type: ** application/json
##### Parameters
#### Response
**Content-Type: ** application/json
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
| 200 | successful operation | Result|
## /server/shutdown
### POST
Shuts down the server
Returns a result with a boolean with value true if the initiation of the shutdown was successful, otherwise an error
#### Request
**Content-Type: ** application/json
##### Parameters
#### Response
**Content-Type: ** application/json
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
| 200 | successful operation | Result|
## /server/status
### GET
Current status of the server
Determines whether or not the game service is contactable and is running and returns this status with a time stamp of the status check. If the server cannot be contacted, isRunning is null.
#### Request
**Content-Type: ** application/json
##### Parameters
#### Response
**Content-Type: ** application/json
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
| 200 | successful operation | ServerStatus|
## /villages
### GET
Villages on the server
All villages for the server, with all details if no filter is applied. If filter is specified with a value of "total", only a total count is returned. Not other filter values are currently supported.
#### Request
**Content-Type: ** application/json
##### Parameters
Name |
Located in |
Required |
Description |
Default |
Schema |
filter |
query |
no |
|
- |
string |
#### Response
**Content-Type: ** application/json
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
| 200 | successful operation | Villages|
## /villages/{village}
### GET
Village summary
Summary for a single village, either by id or name. If the value passed in is a number it is treated as an id, otherwise it is treated as a village name.
#### Request
**Content-Type: ** application/json
##### Parameters
Name |
Located in |
Required |
Description |
Default |
Schema |
village |
path |
yes |
|
- |
string |
#### Response
**Content-Type: ** application/json
| Status Code | Reason | Response Model |
|-------------|-------------|----------------|
| 200 | successful operation | Village|
# Definitions
## Balance
name |
type |
required |
description |
example |
balance |
integer (int64)
|
optional |
- |
|
## Players
name |
type |
required |
description |
example |
count |
integer (int32)
|
optional |
- |
|
players |
array[string]
|
optional |
- |
|
## Result
name |
type |
required |
description |
example |
value |
object
|
optional |
- |
|
error |
string
|
optional |
- |
|
## ServerStatus
name |
type |
required |
description |
example |
running |
boolean
|
optional |
- |
|
connected |
boolean
|
optional |
- |
|
timeStamp |
string (date-time)
|
optional |
- |
|
## TilePosition
name |
type |
required |
description |
example |
x |
integer (int32)
|
optional |
- |
|
y |
integer (int32)
|
optional |
- |
|
## Village
name |
type |
required |
description |
example |
id |
integer (int32)
|
optional |
- |
|
name |
string
|
optional |
- |
|
deedId |
integer (int64)
|
optional |
- |
|
motto |
string
|
optional |
- |
|
kingdom |
string
|
optional |
- |
|
size |
integer (int32)
|
optional |
- |
|
founder |
string
|
optional |
- |
|
mayor |
string
|
optional |
- |
|
readableTimeUntilDisband |
string
|
optional |
- |
|
disbander |
string
|
optional |
- |
|
citizens |
integer (int32)
|
optional |
- |
|
allies |
integer (int32)
|
optional |
- |
|
guards |
integer (int32)
|
optional |
- |
|
tokenPosition |
TilePosition
|
optional |
- |
|
## Villages
name |
type |
required |
description |
example |
total |
integer (int32)
|
optional |
- |
|
count |
integer (int32)
|
optional |
- |
|
villages |
array[Village]
|
optional |
- |
|