BuildingTemplate

Each building within BuildingDepot has a BuildingTemplate as a foundation. The BuildingTemplate helps define the structure of the building. The user has to assign a set of tags to the BuildingTemplate on creation which can be used later on for all the sensors within that building. BuildingTemplate can be defined in the CentralService at http://www.example.com:81/api/buildingtemplate.

Create a Building Template

This request creates a Building Template with the name, description and tagtypes to be used in the buildingtemplate specified by the user.

Example request:

POST /api/template HTTP/1.1
Accept: application/json; charset=utf-8

{
  "data":{
      "name":"Test_Building_Template",
      "description":"New Building Template",
      "tag_types":["floor","room","corridor"]
  }
}

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 TagTypes doesn't exist"
}

{
  "success": "False",
  "error": " Missing parameters"
}

{
  "success": "False",
  "error": " Missing data"
}

Get BuildingTemplate Details

This request retrieves name, description and tagtypes used in the buildingtemplate specified in the request.

Example request:

GET /api/template/Test_Building_Template 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_Template",
    "description":"New Building Template",
    "tags": ["floor","room","corridor"]
}

Example response (for failure):

HTTP/1.1 200 OK
Content-Type: application/json

{  "success": "False",
  "error": " BuildingTemplate does not exist"
  }

Delete Building Template

This request deletes the requested BuildingTemplate and the Tagtypes assigned to it.

Example request:

DELETE /api/template/Test_Building_Template  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": " BuildingTemplate does not exist"
}

{
  "success": "False",
  "error": " BuildingTemplate is in use"
}