DataService¶
The DataService is where all the data related to sensors and the timeseries data of each sensor resides. All the access control related functionality is defined at centralservice is also enforced within the DataService. A new DataService can be defined in the CentralService at http://www.example.com:81/central/dataservice.
Create a new DataService¶
This request creates a new DataService with description,host and port where the datservice will function.
-
POST
/api/dataservice
¶ JSON Parameters: - name (string) – Name of the DataService
- description (string) – Description for the DataService
- host (string) – HostName of the device where the Dataservice is to be installed
- port (string) – Port number of the device where the Dataservice is to be installed
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 (See HTTP 401)
Example request:
POST /api/dataservice
{
"data":{
"name": "ds3"
"description":"Test_ds3",
"host":"127.0.0.3",
"port":"83"
}
}
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": " Missing data"
}
Get DataService Details¶
This request retrieves name, description, hostname and port to used in the dataservice specified in the request.
-
GET
/api/dataservice/<name>
¶ Parameters: - name (string) – Name of the DataService
Returns: - success (string) – Returns ‘True’ if data is retrieved successfully otherwise ‘False’
- name (string) – Name of the DataService
- description (string) – Description for the DataService
- host (string) – HostName of the device where the Dataservice is installed
- port (string) – Port number of the device where the Dataservice is installed
Status Codes: - 200 OK – Success
- 401 Unauthorized – Unauthorized Credentials (See HTTP 401)
Example request:
GET /api/dataservice/ds3
Accept: application/json; charset=utf-8
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{ "success": "True",
"name": "ds3"
"description":"Test_ds3",
"host":"127.0.0.3",
"port":"83"
}
**Example response** (for failure):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": "False",
"error": " DataService does not exist"
}
Delete DataService¶
This request deletes the requested Dataservice from Building Depot.
-
DELETE
/api/dataservice/<name>
¶ Parameters: - name (string) – Name of the DataService
Returns: - success (string) – Returns ‘True’ if the DataService is successfully deleted otherwise ‘False’
Status Codes: - 200 OK – Success
- 401 Unauthorized – Unauthorized Credentials (See HTTP 401)
Example request:
DELETE /api/dataservice/ds3
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": " Dataservice does not exist"
}