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.
-
GET
/api/apps
¶ Returns: - success (string) – Returns ‘True’ if the list of application is successfully retrieved otherwise ‘False’
- app_list (list(string)) – The list of the current user’s application names.
Status Codes: - 200 OK – Success
- 401 Unauthorized – Unauthorized Credentials
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.
-
POST
/api/apps
¶ JSON Parameters: - data (dict) – Contains the information of the new application to be registered.
- name (string) – The name of the new application to be registered.
Returns: - success (string) – Returns ‘True’ if adding a new application was successful or an application with the given name already exists. Othersie ‘False’
- app_id (string) – If successful, contains the new RabitMQ channel ID that corresponds to the new application.
Status Codes: - 200 OK – Success
- 401 Unauthorized – Unauthorized Credentials
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.
-
DELETE
/api/apps
¶ JSON Parameters: - data (dict) – Contains the information of the application to be deleted.
- name (string) – The name of the application to be deleted.
Returns: - success (string) – Returns ‘True’ if adding a new application was successful or an application with the given name already exists. Othersie ‘False’
- error (string) – Details of an error if unsuccessful
Status Codes: - 200 OK – Success
- 401 Unauthorized – Unauthorized Credentials
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"
}