Apps¶
DataService Apps API allows users interact with the underlying app models. This API handles the registration and deletion of apps from the system.
Get List of Registered Apps¶
This retrieves a list of applications of the current user. This API first registers the application to the system, then it opens up a rabbitMQ queue.
Example request:
GET /api/apps HTTP/1.1
Accept: application/json; charset=utf-8
Example response (for success):
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"success": "True",
"app_list": [
"app_example_1", "app_example_2", "app_example_3"
]
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application.json; charset=utf-8
{
"success": "False",
"error": "Missing Parameters"
}
Register a New App¶
This stores a new app for the current user.
If there already exists an application with the given name, this API call has no effect on BuildingDepot.
Example request:
POST /api/apps HTTP/1.1
Accept: application/json; charset=utf-8
{
"data": {
"name": "new_app_name"
}
}
Example response (for success):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "True",
"app_id": ""
}
Example response (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": "Missing Parameters"
}
{
"success": "False",
"error": "Failed to connect broker"
}
{
"success": "False",
"error": "Failed to create queue"
}
Delete an App¶
This deletes an app of the current user.
Example request:
DELETE /api/apps HTTP/1.1
Accept: application/json; charset=utf-8
{
"data": {
"name": "example_app_name"
}
}
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": "Missing Parameters"
}
{
"success": "False",
"error": "Failed to connect broker"
}
{
"success": "False",
"error": "Failed to delete queue"
}
Subscribe to a Sensor¶
This is used to subscribes to the sensor data.
Example request:
POST /api/apps HTTP/1.1
Accept: application/json; charset=utf-8
{
"data": {
"app": "app_name"
"sensor": "sensor_uuid"
}
}
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": "Missing Parameters"
}
{
"success": "False",
"error": "Failed to connect to broker"
}
{
"success": "False",
"error": "Failed to bind queue"
}
{
"success": "False",
"error": "App id doesn't exist"
}
Unsubscribe from a Sensor¶
This is used to unsubscribes from the sensor data.
Example request:
DELETE /api/apps HTTP/1.1
Accept: application/json; charset=utf-8
{
"data": {
"app": "app_name"
"sensor": "sensor_uuid"
}
}
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": "Missing Parameters"
}
{
"success": "False",
"error": "Failed to connect to broker"
}
{
"success": "False",
"error": "Failed to bind queue"
}
{
"success": "False",
"error": "App id doesn't exist"
}