Overview
The Dungeons of Kollchap from What Is Dungeons & Dragons? published 1982
HTTP verbs
RESTful Kollchap tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP verbs.
Verb | Usage |
---|---|
|
Used to retrieve a resource |
|
Used to create a new resource |
|
Used to update an existing resource, including partial updates |
|
Used to delete an existing resource |
HTTP status codes
RESTful characters tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP status codes.
Status code | Usage |
---|---|
|
The request completed successfully |
|
A new resource has been created successfully. The resource’s URI is available from the response’s
|
|
An update to an existing resource has been applied successfully |
|
The request was malformed. The response body will include an error providing further information |
|
The requested resource did not exist |
Headers
Every response has the following header(s):
Name | Description |
---|---|
|
The Content-Type of the payload |
Errors
Whenever an error response (status code >= 400) is returned, the body will contain a JSON object that describes the problem. The error object has the following structure:
Path | Type | Description |
---|---|---|
|
|
The HTTP error that occurred, e.g. |
|
|
The path to which the request was made |
|
|
The HTTP status code, e.g. |
|
|
The time, in milliseconds, at which the error occurred |
For example, a request that attempts to apply a non-existent tag to a character will produce a
400 Bad Request
response:
HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Length: 101
{"timestamp":"2024-12-07T16:27:25.705+00:00","status":400,"error":"Bad Request","path":"/characters"}
Hypermedia
RESTful Kollchap uses hypermedia and resources include links to other resources in their
responses. Responses are in Hypertext
Application Language (HAL) format. Links can be found beneath the _links
key. Users of
the API should not create URIs themselves, instead they should use the above-described
links to navigate from resource to resource.
Resources
Index
The index provides the entry point into the service.
Accessing the index
A GET
request is used to access the index
Response fields
Path | Type | Description |
---|---|---|
|
|
Links to other resources |
Example response
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json
Content-Length: 239
{
"_links" : {
"rooms" : {
"href" : "http://localhost:8080/rooms"
},
"characters" : {
"href" : "http://localhost:8080/characters"
},
"profile" : {
"href" : "http://localhost:8080/profile"
}
}
}
Links
Relation | Description |
---|---|
|
|
|
The Rooms resource |
|
The ALPS resource |
Characters
The Characters resources is used to create and list characters
Listing characters
A GET
request will list all of the service’s characters.
Response fields
Path | Type | Description |
---|---|---|
|
|
An array of Character resources |
|
|
Links to other resources |
Example request
$ curl 'http://localhost:8080/characters' -i -X GET \
-H 'Accept: application/hal+json'
Example response
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json
Content-Length: 5518
{
"_embedded" : {
"characters" : [ {
"name" : "Slammer Kyntire",
"background" : "First-level Fighter searching for the Sword of the Sorcerer.",
"race" : "Human",
"class" : "Fighter",
"alignment" : "Lawful",
"level" : 1,
"armourClass" : 3,
"hitPoints" : 7,
"characteristics" : {
"str" : 18,
"int" : 10,
"wis" : 10,
"dex" : 9,
"con" : 11,
"chr" : 10
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/anAwqL8zkEZT"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/anAwqL8zkEZT"
}
}
}, {
"name" : "Hotfa Nap",
"background" : "First-level Sorceress from a nomad tribe in the Mesta Desert.",
"race" : "Human",
"class" : "MagicUser",
"alignment" : "Neutral",
"level" : 1,
"armourClass" : 9,
"hitPoints" : 5,
"characteristics" : {
"str" : 5,
"int" : 10,
"wis" : 8,
"dex" : 18,
"con" : 13,
"chr" : 9
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/ZtvhzvxdCRkk"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/ZtvhzvxdCRkk"
}
}
}, {
"name" : "Gripper 'The Skin' Longshank",
"background" : "First-level Thief from a tribe on the Albine empire border.",
"race" : "Halfling",
"class" : "Thief",
"alignment" : "Neutral",
"level" : 1,
"armourClass" : 4,
"hitPoints" : 5,
"characteristics" : {
"str" : 5,
"int" : 10,
"wis" : 8,
"dex" : 18,
"con" : 13,
"chr" : 9
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/nX7c3vx3XhCm"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/nX7c3vx3XhCm"
}
}
}, {
"name" : "Zhod Thobi",
"background" : "First-level Cleric N.P.C joins party and receives equal share of treasure.",
"race" : "Human",
"class" : "Cleric",
"alignment" : "Lawful",
"level" : 1,
"armourClass" : 3,
"hitPoints" : 6,
"characteristics" : {
"str" : 11,
"int" : 14,
"wis" : 15,
"dex" : 10,
"con" : 7,
"chr" : 10
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/vcu1g0A1s2cH"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/vcu1g0A1s2cH"
}
}
}, {
"name" : "Belisarius",
"background" : "First-level Thief N.P.C survivor. Currently hiding, if located will join party.",
"race" : "Halfling",
"class" : "Thief",
"alignment" : "Neutral",
"level" : 1,
"armourClass" : 7,
"hitPoints" : 2,
"characteristics" : {
"str" : 5,
"int" : 10,
"wis" : 8,
"dex" : 18,
"con" : 13,
"chr" : 9
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/kd2cOte3npdf"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/kd2cOte3npdf"
}
}
}, {
"name" : "Rosa Dobbit",
"background" : "First-level Fighter N.P.C survivor. Currently captive, if released will join party.",
"race" : "Halfling",
"class" : "Fighter",
"alignment" : "Lawful",
"level" : 1,
"armourClass" : 9,
"hitPoints" : 4,
"characteristics" : {
"str" : 8,
"int" : 9,
"wis" : 8,
"dex" : 14,
"con" : 13,
"chr" : 12
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/0rtYgpPcfCZg"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/0rtYgpPcfCZg"
}
}
}, {
"name" : "Odric",
"background" : "Third-level Cleric N.P.C enemy. Currently in possession of the stolen Statue of Tranfax.",
"race" : "Human",
"class" : "Cleric",
"alignment" : "Chaotic",
"level" : 1,
"armourClass" : 3,
"hitPoints" : 9,
"characteristics" : {
"str" : 5,
"int" : 10,
"wis" : 8,
"dex" : 18,
"con" : 13,
"chr" : 9
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/TuU6JJ0XnZ20"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/TuU6JJ0XnZ20"
}
}
}, {
"name" : "Bobert",
"background" : "Merchant in the dungeon",
"race" : "Human",
"class" : "Thief",
"alignment" : "Neutral",
"level" : 2,
"armourClass" : 3,
"hitPoints" : 6,
"characteristics" : {
"str" : 18,
"int" : 18,
"wis" : 7,
"dex" : 14,
"con" : 9,
"chr" : 7
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/BsRaKI91vMsS"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/BsRaKI91vMsS"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters"
},
"profile" : {
"href" : "http://localhost:8080/profile/characters"
}
}
}
Creating a character
A POST
request is used to create a character.
Request fields
Path | Type | Description | Constraints |
---|---|---|---|
name |
String |
Full name of character |
Must not be blank |
background |
String |
Background history and motivation |
Must not be blank |
race |
String |
One of Dwarf, Elf, Halfling, Human |
Must not be null |
class |
String |
One of Cleric, Fighter, MagicUser, Thief |
Must not be null |
level |
Number |
Experience and abilities scale. Higher is better |
Must be at least 1 and at most 20 |
armourClass |
Number |
Armour and hit protection scale. Lower is better |
Must be at least 0 and at most 9 |
hitPoints |
Number |
Damage a character can take. Higher is better |
Must be at least 0 |
alignment |
String |
One of Chaotic, Lawful, Neutral |
Must not be null |
characteristics |
Object |
Must not be null |
Example request
$ curl 'http://localhost:8080/characters' -i -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{"name":"Bobert","background":"Merchant in the dungeon","race":"Human","class":"Thief","alignment":"Neutral","level":2,"armourClass":3,"hitPoints":6,"characteristics":{"str":18,"int":18,"wis":7,"dex":14,"con":9,"chr":7}}'
Example response
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: http://localhost:8080/characters/BsRaKI91vMsS
Characteristics
Request fields-characteristics
Path | Type | Description | Constraints |
---|---|---|---|
str |
Number |
Strength attribute |
Must be at least 3 and at most 18 |
int |
Number |
Intelligence attribute |
Must be at least 3 and at most 18 |
wis |
Number |
Wisdom attribute |
Must be at least 3 and at most 18 |
dex |
Number |
Dexterity attribute |
Must be at least 3 and at most 18 |
con |
Number |
Constitution attribute |
Must be at least 3 and at most 18 |
chr |
Number |
Charisma attribute |
Must be at least 3 and at most 18 |
Character
The Character resource is used to retrieve, update, and delete individual characters
Retrieve a character
A GET
request will retrieve the details of a character
Response fields
Path | Type | Description |
---|---|---|
|
|
Full name of character |
|
|
Background history and motivation |
|
|
One of Dwarf, Elf, Halfling, Human |
|
|
One of Cleric, Fighter, MagicUser, Thief |
|
|
Experience and abilities scale. Higher is better |
|
|
Armour and hit protection scale. Lower is better |
|
|
Damage a character can take. Higher is better |
|
|
One of Chaotic, Lawful, Neutral |
|
|
|
|
|
Links to other resources |
Example request
$ curl 'http://localhost:8080/characters/anAwqL8zkEZT' -i -X GET \
-H 'Accept: application/hal+json'
Example response
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json
Content-Length: 558
{
"name" : "Slammer Kyntire",
"background" : "First-level Fighter searching for the Sword of the Sorcerer.",
"race" : "Human",
"class" : "Fighter",
"alignment" : "Lawful",
"level" : 1,
"armourClass" : 3,
"hitPoints" : 7,
"characteristics" : {
"str" : 18,
"int" : 10,
"wis" : 10,
"dex" : 9,
"con" : 11,
"chr" : 10
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/characters/anAwqL8zkEZT"
},
"gameCharacter" : {
"href" : "http://localhost:8080/characters/anAwqL8zkEZT"
}
}
}
Update a Character
A PATCH
request is used to update a Character
Request fields
Path | Type | Description | Constraints |
---|---|---|---|
name |
String |
Full name of character |
Must not be blank |
background |
String |
Background history and motivation |
Must not be blank |
race |
String |
One of Dwarf, Elf, Halfling, Human |
Must not be null |
class |
String |
One of Cleric, Fighter, MagicUser, Thief |
Must not be null |
level |
Number |
Experience and abilities scale. Higher is better |
Must be at least 1 and at most 20 |
armourClass |
Number |
Armour and hit protection scale. Lower is better |
Must be at least 0 and at most 9 |
hitPoints |
Number |
Damage a character can take. Higher is better |
Must be at least 0 |
alignment |
String |
One of Chaotic, Lawful, Neutral |
Must not be null |
characteristics |
Object |
Must not be null |
Example request
$ curl 'http://localhost:8080/characters/zMhQdolwIBvj' -i -X PATCH \
-H 'Content-Type: application/hal+json;charset=UTF-8' \
-d '{"name":"Update name","background":"Update background","race":"Dwarf","class":"Cleric","alignment":"Chaotic","level":3,"armourClass":2,"hitPoints":1,"characteristics":{"str":16,"int":10,"wis":3,"dex":6,"con":9,"chr":10}}'
Example response
HTTP/1.1 204 No Content
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Rooms
The Rooms resources is used to create and list rooms
Listing rooms
A GET
request will list all of the service’s rooms.
Response fields
Path | Type | Description |
---|---|---|
|
|
An array of Room resources |
|
|
Links to other resources |
Example request
$ curl 'http://localhost:8080/rooms' -i -X GET \
-H 'Accept: application/hal+json'
Example response
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json
Content-Length: 22902
{
"_embedded" : {
"rooms" : [ {
"key" : "1",
"name" : "Orc Guardroom",
"description" : "In this room are two sets of bunk beds...In the centre is a large battered table...",
"egress" : [ "2", "4", "5", "6" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/YDYJy5pbjDfS"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/YDYJy5pbjDfS"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/2",
"name" : "Rubbish Dump"
}, {
"href" : "http://localhost:8080/rooms/keys/4",
"name" : "Corridor Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/5",
"name" : "Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
} ]
}
}, {
"key" : "2",
"name" : "Rubbish Dump",
"description" : "This room is used by the inhabitants...It is filled with broken furniture, bones...",
"egress" : [ "1", "4", "5", "6" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/Wthn8zy7MLp1"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/Wthn8zy7MLp1"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/1",
"name" : "Orc Guardroom"
}, {
"href" : "http://localhost:8080/rooms/keys/4",
"name" : "Corridor Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/5",
"name" : "Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
} ]
}
}, {
"key" : "3",
"name" : "Floorless Room",
"description" : "This room was once the entrance to the main part of the shrine...",
"egress" : [ "4", "16", "17", "18" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/kUtNMgOK6nok"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/kUtNMgOK6nok"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/4",
"name" : "Corridor Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/16",
"name" : "Old Waiting Room"
}, {
"href" : "http://localhost:8080/rooms/keys/17",
"name" : "Oracle Room"
}, {
"href" : "http://localhost:8080/rooms/keys/18",
"name" : "Pit Trap"
} ]
}
}, {
"key" : "4",
"name" : "Corridor Trap",
"description" : "The Slime is clinging to the west wall and will...fall on a party member...",
"egress" : [ "1", "2", "3", "5", "6" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/uDIhCLPHjmAV"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/uDIhCLPHjmAV"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/1",
"name" : "Orc Guardroom"
}, {
"href" : "http://localhost:8080/rooms/keys/2",
"name" : "Rubbish Dump"
}, {
"href" : "http://localhost:8080/rooms/keys/3",
"name" : "Floorless Room"
}, {
"href" : "http://localhost:8080/rooms/keys/5",
"name" : "Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
} ]
}
}, {
"key" : "5",
"name" : "Storeroom",
"description" : "This room was once a storeroom for the temple...some moldy food remains...",
"egress" : [ "1", "2", "3", "5", "6" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/t6e0YMoyKUeF"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/t6e0YMoyKUeF"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/1",
"name" : "Orc Guardroom"
}, {
"href" : "http://localhost:8080/rooms/keys/2",
"name" : "Rubbish Dump"
}, {
"href" : "http://localhost:8080/rooms/keys/3",
"name" : "Floorless Room"
}, {
"href" : "http://localhost:8080/rooms/keys/5",
"name" : "Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
} ]
}
}, {
"key" : "6",
"name" : "Healing Pool",
"description" : "This pool is circular with a radius of about three feet...and has a greenish tint...",
"egress" : [ "1", "2", "4", "5", "7", "8" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/sjoWFKB8kIWd"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/sjoWFKB8kIWd"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/1",
"name" : "Orc Guardroom"
}, {
"href" : "http://localhost:8080/rooms/keys/2",
"name" : "Rubbish Dump"
}, {
"href" : "http://localhost:8080/rooms/keys/4",
"name" : "Corridor Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/5",
"name" : "Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/7",
"name" : "Coffin Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/8",
"name" : "Odric's Bedroom"
} ]
}
}, {
"key" : "7",
"name" : "Coffin Storeroom",
"description" : "This room is bare except for fifteen plain wooden coffins...stacked in threes...",
"egress" : [ "6", "8" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/J6SDlhW5WTtl"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/J6SDlhW5WTtl"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
}, {
"href" : "http://localhost:8080/rooms/keys/8",
"name" : "Odric's Bedroom"
} ]
}
}, {
"key" : "8",
"name" : "Odric's Bedroom",
"description" : "This room has a sumptuously furnished bed with silk sheets...",
"egress" : [ "6", "7", "10", "12" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/UXYcrCBNpLrF"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/UXYcrCBNpLrF"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
}, {
"href" : "http://localhost:8080/rooms/keys/7",
"name" : "Coffin Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/10",
"name" : "UnderPriests' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
} ]
}
}, {
"key" : "9",
"name" : "The Office",
"description" : "This room serves as Odric's office...On the table is a mass of papers...",
"egress" : [ "6", "7", "9a", "10", "12" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/axCy9dM5PNXn"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/axCy9dM5PNXn"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
}, {
"href" : "http://localhost:8080/rooms/keys/7",
"name" : "Coffin Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/9a",
"name" : "Collapsed Room"
}, {
"href" : "http://localhost:8080/rooms/keys/10",
"name" : "UnderPriests' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
} ]
}
}, {
"key" : "9a",
"name" : "Collapsed Room",
"description" : "The Rockmen are rummaging around in this room...",
"egress" : [ "9" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/dbsAq8kn1Lmj"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/dbsAq8kn1Lmj"
},
"egress" : {
"href" : "http://localhost:8080/rooms/keys/9",
"name" : "The Office"
}
}
}, {
"key" : "10",
"name" : "UnderPriests' Room",
"description" : "This room is used by the three Clerics as a base...",
"egress" : [ "8", "9", "11", "12" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/t9vH14SAThM1"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/t9vH14SAThM1"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/8",
"name" : "Odric's Bedroom"
}, {
"href" : "http://localhost:8080/rooms/keys/9",
"name" : "The Office"
}, {
"href" : "http://localhost:8080/rooms/keys/11",
"name" : "Room of Absolution"
}, {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
} ]
}
}, {
"key" : "11",
"name" : "Room of Absolution",
"description" : "This room is almost wholly bare except for six large urns...",
"egress" : [ "10", "12", "21", "22", "23" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/LlC5O2XMR1vC"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/LlC5O2XMR1vC"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/10",
"name" : "UnderPriests' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
}, {
"href" : "http://localhost:8080/rooms/keys/22",
"name" : "Meditation Room"
}, {
"href" : "http://localhost:8080/rooms/keys/23",
"name" : "Flooded Storeroom"
} ]
}
}, {
"key" : "12",
"name" : "Great Sacrifice Chamber",
"description" : "This room is vast...There is a pole in the centre...",
"egress" : [ "8", "9", "10", "11", "13", "15", "21", "22", "23" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/VHoQ7jStG45k"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/VHoQ7jStG45k"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/8",
"name" : "Odric's Bedroom"
}, {
"href" : "http://localhost:8080/rooms/keys/9",
"name" : "The Office"
}, {
"href" : "http://localhost:8080/rooms/keys/10",
"name" : "UnderPriests' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/11",
"name" : "Room of Absolution"
}, {
"href" : "http://localhost:8080/rooms/keys/13",
"name" : "The Cells"
}, {
"href" : "http://localhost:8080/rooms/keys/15",
"name" : "Changing Room"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
}, {
"href" : "http://localhost:8080/rooms/keys/22",
"name" : "Meditation Room"
}, {
"href" : "http://localhost:8080/rooms/keys/23",
"name" : "Flooded Storeroom"
} ]
}
}, {
"key" : "13",
"name" : "The Cells",
"description" : "There are three cells...The cells are all locked...",
"egress" : [ "12" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/YwjqKXecu6go"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/YwjqKXecu6go"
},
"egress" : {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
}
}
}, {
"key" : "14",
"name" : "Treasure Chamber",
"description" : "The door to this room is locked...",
"egress" : [ "8", "15" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/nimqDxxCYfFN"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/nimqDxxCYfFN"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/8",
"name" : "Odric's Bedroom"
}, {
"href" : "http://localhost:8080/rooms/keys/15",
"name" : "Changing Room"
} ]
}
}, {
"key" : "15",
"name" : "Changing Room",
"description" : "This room is used by Odric for changing into his sacrifice robes...",
"egress" : [ "10", "12", "21", "22", "23" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/GBGIjLoRlMsF"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/GBGIjLoRlMsF"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/10",
"name" : "UnderPriests' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
}, {
"href" : "http://localhost:8080/rooms/keys/22",
"name" : "Meditation Room"
}, {
"href" : "http://localhost:8080/rooms/keys/23",
"name" : "Flooded Storeroom"
} ]
}
}, {
"key" : "16",
"name" : "Old Waiting Room",
"description" : "This room was once a waiting room for the oracle...",
"egress" : [ "3", "17", "18", "19", "21" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/mvU6fgmC3dtc"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/mvU6fgmC3dtc"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/3",
"name" : "Floorless Room"
}, {
"href" : "http://localhost:8080/rooms/keys/17",
"name" : "Oracle Room"
}, {
"href" : "http://localhost:8080/rooms/keys/18",
"name" : "Pit Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/19",
"name" : "Goblins' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
} ]
}
}, {
"key" : "17",
"name" : "Oracle Room",
"description" : "This room used to be an oracle room...There is a statue of a seven-foot-high human...",
"egress" : [ "3", "16", "18", "19", "20", "21" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/yULf2xDbew5E"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/yULf2xDbew5E"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/3",
"name" : "Floorless Room"
}, {
"href" : "http://localhost:8080/rooms/keys/16",
"name" : "Old Waiting Room"
}, {
"href" : "http://localhost:8080/rooms/keys/18",
"name" : "Pit Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/19",
"name" : "Goblins' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/20",
"name" : "Cave"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
} ]
}
}, {
"key" : "18",
"name" : "Pit Trap",
"description" : "At this point the floor is covering a pit...The pit used to be a tunnel...",
"egress" : [ "3", "16", "17", "19", "20", "21" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/Q58jrT68Wykg"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/Q58jrT68Wykg"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/3",
"name" : "Floorless Room"
}, {
"href" : "http://localhost:8080/rooms/keys/16",
"name" : "Old Waiting Room"
}, {
"href" : "http://localhost:8080/rooms/keys/17",
"name" : "Oracle Room"
}, {
"href" : "http://localhost:8080/rooms/keys/19",
"name" : "Goblins' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/20",
"name" : "Cave"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
} ]
}
}, {
"key" : "19",
"name" : "Goblins' Room",
"description" : "This room is very stark, with only straw for bedding, on the floor...",
"egress" : [ "3", "16", "17", "18", "20", "21" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/NUhsFEJYZAT2"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/NUhsFEJYZAT2"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/3",
"name" : "Floorless Room"
}, {
"href" : "http://localhost:8080/rooms/keys/16",
"name" : "Old Waiting Room"
}, {
"href" : "http://localhost:8080/rooms/keys/17",
"name" : "Oracle Room"
}, {
"href" : "http://localhost:8080/rooms/keys/18",
"name" : "Pit Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/20",
"name" : "Cave"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
} ]
}
}, {
"key" : "20",
"name" : "Cave",
"description" : "This room is a cave littered with rocks and boulders...the atmosphere is humid...",
"egress" : [ "3", "16", "17", "18", "21" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/XPOamtukF2ym"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/XPOamtukF2ym"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/3",
"name" : "Floorless Room"
}, {
"href" : "http://localhost:8080/rooms/keys/16",
"name" : "Old Waiting Room"
}, {
"href" : "http://localhost:8080/rooms/keys/17",
"name" : "Oracle Room"
}, {
"href" : "http://localhost:8080/rooms/keys/18",
"name" : "Pit Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
} ]
}
}, {
"key" : "21",
"name" : "Statue Room",
"description" : "In the centre of the room is a statue of a man with his hands held out...",
"egress" : [ "3", "11", "12", "16", "17", "18", "19", "22", "23" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/u6w592W95aI8"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/u6w592W95aI8"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/3",
"name" : "Floorless Room"
}, {
"href" : "http://localhost:8080/rooms/keys/11",
"name" : "Room of Absolution"
}, {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
}, {
"href" : "http://localhost:8080/rooms/keys/16",
"name" : "Old Waiting Room"
}, {
"href" : "http://localhost:8080/rooms/keys/17",
"name" : "Oracle Room"
}, {
"href" : "http://localhost:8080/rooms/keys/18",
"name" : "Pit Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/19",
"name" : "Goblins' Room"
}, {
"href" : "http://localhost:8080/rooms/keys/22",
"name" : "Meditation Room"
}, {
"href" : "http://localhost:8080/rooms/keys/23",
"name" : "Flooded Storeroom"
} ]
}
}, {
"key" : "22",
"name" : "Meditation Room",
"description" : "This room was originally a meditation room...the walls are ornately decorated...",
"egress" : [ "11", "12", "21", "23" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/B7eqckg2tPqr"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/B7eqckg2tPqr"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/11",
"name" : "Room of Absolution"
}, {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
}, {
"href" : "http://localhost:8080/rooms/keys/23",
"name" : "Flooded Storeroom"
} ]
}
}, {
"key" : "23",
"name" : "Flooded Storeroom",
"description" : "The stairs leading down are wet and so anyone going down them...",
"egress" : [ "11", "12", "16", "21", "22", "23" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/hzEO4Rz6q7UT"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/hzEO4Rz6q7UT"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/11",
"name" : "Room of Absolution"
}, {
"href" : "http://localhost:8080/rooms/keys/12",
"name" : "Great Sacrifice Chamber"
}, {
"href" : "http://localhost:8080/rooms/keys/16",
"name" : "Old Waiting Room"
}, {
"href" : "http://localhost:8080/rooms/keys/21",
"name" : "Statue Room"
}, {
"href" : "http://localhost:8080/rooms/keys/22",
"name" : "Meditation Room"
}, {
"href" : "http://localhost:8080/rooms/keys/23",
"name" : "Flooded Storeroom"
} ]
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms"
},
"profile" : {
"href" : "http://localhost:8080/profile/rooms"
},
"search" : {
"href" : "http://localhost:8080/rooms/search"
}
}
}
Creating a room
A POST
request is used to create a room.
Request fields
Path | Type | Description | Constraints |
---|---|---|---|
key |
String |
map key of dungeon room |
Must not be blank |
name |
String |
Name of dungeon room |
Must not be blank |
egress |
Array |
connected rooms in the dungeon |
|
description |
String |
Content and objects in room |
Must not be blank |
Example request
$ curl 'http://localhost:8080/rooms' -i -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{"key":"42","name":"Secret room","description":"Unknown room","egress":["41a"]}'
Example response
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: http://localhost:8080/rooms/xMTIdmIyOfHK
Room
The Room resource is used to retrieve, update, and delete individual rooms
Links
Relation | Description |
---|---|
|
This room |
|
Link to the room resource |
|
Link to other connected room resources |
Retrieve a room
A GET
request will retrieve the details of a room
Response fields
Path | Type | Description |
---|---|---|
|
|
map key of dungeon room |
|
|
Name of dungeon room |
|
|
connected rooms in the dungeon |
|
|
Content and objects in room |
|
|
Links to other resources |
Example request
$ curl 'http://localhost:8080/rooms/YDYJy5pbjDfS' -i -X GET \
-H 'Accept: application/hal+json'
Example response
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json
Content-Length: 758
{
"key" : "1",
"name" : "Orc Guardroom",
"description" : "In this room are two sets of bunk beds...In the centre is a large battered table...",
"egress" : [ "2", "4", "5", "6" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/YDYJy5pbjDfS"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/YDYJy5pbjDfS"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/2",
"name" : "Rubbish Dump"
}, {
"href" : "http://localhost:8080/rooms/keys/4",
"name" : "Corridor Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/5",
"name" : "Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
} ]
}
}
Update a Room
A PATCH
request is used to update a Room
Request fields
Path | Type | Description | Constraints |
---|---|---|---|
key |
String |
map key of dungeon room |
Must not be blank |
name |
String |
Name of dungeon room |
Must not be blank |
egress |
Array |
connected rooms in the dungeon |
|
description |
String |
Content and objects in room |
Must not be blank |
Example request
$ curl 'http://localhost:8080/rooms/ucLXRqHPKKyP' -i -X PATCH \
-H 'Content-Type: application/hal+json;charset=UTF-8' \
-d '{"key":"44a","name":"Update room","description":"Update description","egress":["44"]}'
Example response
HTTP/1.1 204 No Content
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Retrieve a room by key attribute
A GET
request will retrieve the details of a room
Request parameters
Snippet request-parameters not found for operation::room-keys-example
Example request
$ curl 'http://localhost:8080/rooms/search/keys?key=1' -i -X GET \
-H 'Accept: application/hal+json'
Example response
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json
Content-Length: 758
{
"key" : "1",
"name" : "Orc Guardroom",
"description" : "In this room are two sets of bunk beds...In the centre is a large battered table...",
"egress" : [ "2", "4", "5", "6" ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/rooms/YDYJy5pbjDfS"
},
"dungeonRoom" : {
"href" : "http://localhost:8080/rooms/YDYJy5pbjDfS"
},
"egress" : [ {
"href" : "http://localhost:8080/rooms/keys/2",
"name" : "Rubbish Dump"
}, {
"href" : "http://localhost:8080/rooms/keys/4",
"name" : "Corridor Trap"
}, {
"href" : "http://localhost:8080/rooms/keys/5",
"name" : "Storeroom"
}, {
"href" : "http://localhost:8080/rooms/keys/6",
"name" : "Healing Pool"
} ]
}
}