SensorGroups¶
SensorGroups are a virtual collection of sensors that are created based on the tags that are specified. Each sensor may consist a set of tags. The list of sensors that belong to a SensorGroup can be changed by modifying the tags attached to this SensorGroup. All sensors having the current tags will fall under this SensorGroup automatically for any subsequent operations. SensorGroups can be defined in the CentralService at http://www.example.com:81/api/sensorgroup.
Create SensorGroup¶
This request creates a new SensorGroup with the name and description in the building specified by the user.
- POST /api/sensor_group¶
- JSON Parameters:
- data (dictionary) – Contains the information about the SensorGroup
name (string) – Name of the SensorGroup
building (string) – Building to which this sensor group belongs
description (string) – Description of the SensorGroup
- 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:
200 OK – Success
401 Unauthorized – Unauthorized Credentials
Example request:
POST /api/sensor_group HTTP/1.1
Accept: application/json; charset=utf-8
{ "data": {
"name":"Test Sensor Group",
"building":"NSH",
"description":"Description for Sensor Group"
}
}
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": "Building does not exist"
}
Get SensorGroup Details¶
This request retrieves the details of a SensorGroup
- GET /api/sensor_group/<name>¶
- Parameters:
name (string) – Name of Sensor group (compulsory)
- Returns:
name (string) – Contains the name of the SensorGroup
description (string) – Contains the description of the SensorGroup
building (string) – Contains the name of the building of the SensorGroup
- Status Codes:
200 OK – Success
401 Unauthorized – Unauthorized Credentials
Example request:
GET /api/sensor_group/Test HTTP/1.1
Accept: application/json; charset=utf-8
Example response (for success):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success" : "true"
"name":"Test",
"description": "A SensorGroup for Test"
"building":"NSH"
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": "SensorGroup does not exist"
}
Delete SensorGroup¶
This request deletes the SensorGroup
- DELETE /api/sensor_group/<name>¶
- Parameters:
email (string) – Name of the SensorGroup
- Returns:
success (string) – Returns ‘True’ if the SensorGroup is successfully deleted otherwise ‘False’
- Status Codes:
200 OK – Success
401 Unauthorized – Unauthorized Credentials
Example request:
DELETE /api/sensor_group/Test HTTP/1.1
Accept: application/json; charset=utf-8
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": "SensorGroup does not exist"
}