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/central/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.

POST /api/building
JSON Parameters:
 
  • name (string) – Name of the Building
  • description (string) – Description for the Building
  • template (string) – Name of a BuildingTemplate
Returns:
  • success (string) – Returns ‘True’ if data is posted successfully otherwise ‘False’
  • error (string) – An additional value that will be present only if the request fails specifying the cause for failure
Status Codes:

Example request:

POST /api/building

{
  "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.

GET /api/building/<name>
Parameters:
  • name (string) – Name of the Building
Returns:
  • success (string) – Returns ‘True’ if data is retrieved successfully otherwise ‘False’
  • name (string) – Name of the Building
  • description (string) – Description for the Building
  • template (string) – BuildingTemplate assigned for the Building.
Status Codes:

Example request:

GET /api/building/Test_Building

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.

DELETE /api/building/<name>
Parameters:
  • name (string) – Name of the Building
Returns:
  • success (string) – Returns ‘True’ if the Building is successfully deleted otherwise ‘False’
Status Codes:

Example request:

DELETE /api/building/Test_Building
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"
}