#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 <a id="getPlayers">Players in the server cluster</a> 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 <table border="1"> <tr> <th>Name</th> <th>Located in</th> <th>Required</th> <th>Description</th> <th>Default</th> <th>Schema</th> </tr> <tr> <th>filter</th> <td>query</td> <td>no</td> <td> </td> <td> - </td> <td>string </td> </tr> </table> #### Response **Content-Type: ** application/json | Status Code | Reason | Response Model | |-------------|-------------|----------------| | 200 | successful operation | <a href="#/definitions/Players">Players</a>| ## /players/{player}/money ### GET <a id="getBalance">Retrieve the value for a player</a> Returns an error if the player cannot be found #### Request **Content-Type: ** application/json ##### Parameters <table border="1"> <tr> <th>Name</th> <th>Located in</th> <th>Required</th> <th>Description</th> <th>Default</th> <th>Schema</th> </tr> <tr> <th>player</th> <td>path</td> <td>yes</td> <td> </td> <td> - </td> <td>string </td> </tr> </table> #### Response **Content-Type: ** application/json | Status Code | Reason | Response Model | |-------------|-------------|----------------| | 200 | successful operation | <a href="#/definitions/Balance">Balance</a>| ### POST <a id="addMoney">Add money to or remove money from a player&#x27;s bank account</a> Returns a message indicating the result of the transaction #### Request **Content-Type: ** application/json ##### Parameters <table border="1"> <tr> <th>Name</th> <th>Located in</th> <th>Required</th> <th>Description</th> <th>Default</th> <th>Schema</th> </tr> <tr> <th>player</th> <td>path</td> <td>yes</td> <td> </td> <td> - </td> <td>string </td> </tr> </table> #### Response **Content-Type: ** application/json | Status Code | Reason | Response Model | |-------------|-------------|----------------| | 200 | successful operation | <a href="#/definitions/Result">Result</a>| ## /server/broadcast ### POST <a id="announce">Broadcasts an announcement to the server</a> 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 | <a href="#/definitions/Result">Result</a>| ## /server/shutdown ### POST <a id="shutdown">Shuts down the server</a> 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 | <a href="#/definitions/Result">Result</a>| ## /server/status ### GET <a id="getStatus">Current status of the server</a> 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 | <a href="#/definitions/ServerStatus">ServerStatus</a>| ## /villages ### GET <a id="getVillages">Villages on the server</a> All villages for the server, with all details if no filter is applied. If filter is specified with a value of &quot;total&quot;, only a total count is returned. Not other filter values are currently supported. #### Request **Content-Type: ** application/json ##### Parameters <table border="1"> <tr> <th>Name</th> <th>Located in</th> <th>Required</th> <th>Description</th> <th>Default</th> <th>Schema</th> </tr> <tr> <th>filter</th> <td>query</td> <td>no</td> <td> </td> <td> - </td> <td>string </td> </tr> </table> #### Response **Content-Type: ** application/json | Status Code | Reason | Response Model | |-------------|-------------|----------------| | 200 | successful operation | <a href="#/definitions/Villages">Villages</a>| ## /villages/{village} ### GET <a id="getVillage">Village summary</a> 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 <table border="1"> <tr> <th>Name</th> <th>Located in</th> <th>Required</th> <th>Description</th> <th>Default</th> <th>Schema</th> </tr> <tr> <th>village</th> <td>path</td> <td>yes</td> <td> </td> <td> - </td> <td>string </td> </tr> </table> #### Response **Content-Type: ** application/json | Status Code | Reason | Response Model | |-------------|-------------|----------------| | 200 | successful operation | <a href="#/definitions/Village">Village</a>| # Definitions ## <a name="/definitions/Balance">Balance</a> <table border="1"> <tr> <th>name</th> <th>type</th> <th>required</th> <th>description</th> <th>example</th> </tr> <tr> <td>balance</td> <td> integer (int64) </td> <td>optional</td> <td>-</td> <td></td> </tr> </table> ## <a name="/definitions/Players">Players</a> <table border="1"> <tr> <th>name</th> <th>type</th> <th>required</th> <th>description</th> <th>example</th> </tr> <tr> <td>count</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>players</td> <td> array[string] </td> <td>optional</td> <td>-</td> <td></td> </tr> </table> ## <a name="/definitions/Result">Result</a> <table border="1"> <tr> <th>name</th> <th>type</th> <th>required</th> <th>description</th> <th>example</th> </tr> <tr> <td>value</td> <td> object </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>error</td> <td> string </td> <td>optional</td> <td>-</td> <td></td> </tr> </table> ## <a name="/definitions/ServerStatus">ServerStatus</a> <table border="1"> <tr> <th>name</th> <th>type</th> <th>required</th> <th>description</th> <th>example</th> </tr> <tr> <td>running</td> <td> boolean </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>connected</td> <td> boolean </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>timeStamp</td> <td> string (date-time) </td> <td>optional</td> <td>-</td> <td></td> </tr> </table> ## <a name="/definitions/TilePosition">TilePosition</a> <table border="1"> <tr> <th>name</th> <th>type</th> <th>required</th> <th>description</th> <th>example</th> </tr> <tr> <td>x</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>y</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> </table> ## <a name="/definitions/Village">Village</a> <table border="1"> <tr> <th>name</th> <th>type</th> <th>required</th> <th>description</th> <th>example</th> </tr> <tr> <td>id</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>name</td> <td> string </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>deedId</td> <td> integer (int64) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>motto</td> <td> string </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>kingdom</td> <td> string </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>size</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>founder</td> <td> string </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>mayor</td> <td> string </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>readableTimeUntilDisband</td> <td> string </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>disbander</td> <td> string </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>citizens</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>allies</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>guards</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>tokenPosition</td> <td> <a href="#/definitions/TilePosition">TilePosition</a> </td> <td>optional</td> <td>-</td> <td></td> </tr> </table> ## <a name="/definitions/Villages">Villages</a> <table border="1"> <tr> <th>name</th> <th>type</th> <th>required</th> <th>description</th> <th>example</th> </tr> <tr> <td>total</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>count</td> <td> integer (int32) </td> <td>optional</td> <td>-</td> <td></td> </tr> <tr> <td>villages</td> <td> array[<a href="#/definitions/Village">Village</a>] </td> <td>optional</td> <td>-</td> <td></td> </tr> </table>