Buildings¶
All the buildings that are present within the deployment of BuildingDepot are defined here. When adding a new building a BuildingTemplate has to be selected which defines the structure of this building. The tags that are available to be assigned to this building are dependent on the BuildingTemplate. Tags can be selected and the values for each of them can be specified here. Each tag can have multiple values specified for it. Building can be defined in the CentralService at http://www.example.com:81/api/building.
Create a new Building¶
This request creates a new Building with name, description and building template to be used in the building specified by the user.
Example request:
POST /api/building HTTP/1.1
Accept: application/json; charset=utf-8
{
"data":{
"name":"Test_Building",
"description":"New Building",
"template":"Test_Building_Template"
}
}
Example response (for success):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "True"
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": " BuildingTemplate does not exist"
}
{
"success": "False",
"error": " Missing parameters"
}
{
"success": "False",
"error": " Missing data"
}
Get Building Details¶
This request retrieves name, description and template to used in the building specified in the request.
Example request:
GET /api/building/Test_Building HTTP/1.1
Accept: application/json; charset=utf-8
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{ "success": "True",
"name": "Test_Building",
"description":"New Building",
"template": "Test_Building_Template"
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": " Building does not exist"
}
Delete Building¶
This request deletes the requested Building and the template assigned to it.
Example request:
DELETE /api/building/Test_Building HTTP/1.1
Accept: application/json; charset=utf-8
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "True"
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": " Building does not exist"
}
{
"success": "False",
"error": " Building is in use"
}
Create a new Building Tag¶
This request creates a new Tag Value pair for a Building
Example request:
POST /api/building/WeanHall/tags HTTP/1.1
Accept: application/json; charset=utf-8
{
"data":{
"name":"corridor",
"value": 10,
"parents": [{"name": "floor", "value": "1"}]
}
}
Example response (for success):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "True"
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": "One of the buildings does not exist"
}
{
"success": "False",
"error": " Missing parameters"
}
{
"success": "False",
"error": " Missing data"
}
Get Building Tag Details¶
This request retrieves name, description and template to used in the building specified in the request.
Example request:
GET /api/building/WeanHall/tags HTTP/1.1
Accept: application/json; charset=utf-8
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "True",
"pairs": {
"Room": [],
"corridor": ["floor"],
"floor": []
},
"tags": [
{ "value": "1",
"parents": [],
"name": "floor",
"can_delete": false
},
{
"value": "10",
"parents": [
{
"name": "floor",
"value": "1"
}
],
"name": "corridor",
"can_delete": true
}
]
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": "One of the buildings does not exist"
}
{
"success": "False",
"error": " Missing parameters"
}
Delete Building Tags¶
This request deletes the requested Building and the template assigned to it.
Example request:
DELETE /api/building/WeanHall/tags HTTP/1.1
Accept: application/json; charset=utf-8
{ "data":{
"name":"corridor",
"value": "10",
}
}
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "True"
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": " This tag value is being referenced, cannot delete"
}
{
"success": "False",
"error": "Tag value does not exist"
}
{
"success": "False",
"error": "Missing data"
}