This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.REST-API.txt
71 lines (62 loc) · 5.04 KB
/
.REST-API.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
**********************************
Database (sensors):
Table -> id:
--------------------
1. sensorID --- primary key
2. sensorNick
3. sensorTypeID --- foreign key
Table -> types:
--------------------
1. sensorTypeID --- primary key
2. sensorType
3. unit
4. repetitions
5. brakeTime
6. sleepTime
Table -> {sensorID}
--------------------
1. date
2. value
3. rowID --- primary key
***********************************
REST-API:
host address: {host-IP}:{host-port}/
Table -> id:
---------------------
GET /sensors/id/ //returns the complete Table -> id + types; result : [{
"sensorID": "SENSOR_ID",
"sensorNick": "SENSOR_NICK",
"sensorTypeID": ID,
"sensorType": "SENSOR_TYPE",
"unit": "UNIT",
"repetitions": NUMBER,
"sleepTime": NUMBER
}, {...}]
GET /sensors/id/{sensorID} //returns row with of the given sensorID; result: [{
"sensorID": "SENSOR_ID",
"sensorNick": "SENSOR_NICK",
"sensorTypeID": ID,
"sensorType": "SENSOR_TYPE",
"unit": "UNIT"
"repetitions": NUMBER,
"sleepTime": NUMBER
}]
GET /sensors/id/{sensorID}/sensorType //returns types.sensorType of specific sensorID; result: [{ "sensorType" : "SENSOR_TYPE"}]
GET /sensors/id/{sensorID}/sensorNick //returns sensorType of specific sensorID; result: [{ "sensorNick" : "SENSOR_NICK"}]
PUT /sensors/id/{sensorID} //updates sensorNick or/and sensorTypeID; body: {"sensorTypeID": NUMBER, "sensorNick" : "SENSOR_NICK"}
POST /sensors/id/ //add new Sensor to Table -> id and create Table -> {sensorID}; body: {"sensorID":"SENSOR_ID", "sensorNick":"SENSOR_NICK"}
DELETE /sensors/id/{sensorID}/ //delete Table -> {sensorID} and entry in Table -> id
Table -> {sensorID}
----------------------
GET /sensors/{sensorID}?date1={date1}&date2={date2} //returns the table from date1 until date2. If no dates are given, all entries are returned -> {sensorID}; result: [{ "rowID" : NUMBER, "date": "DATETIME_STRING", "value" : NUMBER},{...},...]
POST /sensors/{sensorID}/ //adds a new table entry in Table -> {sensorID}; body: {"date":"DATETIME_STRING", "value":NUMBER}
DELETE /sensors/{sensorID}?date1={date1}&date2={date2} //delete entries from date1 to date2. If no dates are given, all entries are deleted
Table -> types
----------------------
GET /sensors/types //returns all values from table types; result: [{ "sensorTypeID" : NUMBER, "sensorType" : "SENSOR_TYPE", "unit": "UNIT", "repetitions": NUMBER, "sleepTime": NUMBER}, {...},...]
POST /sensors/types //adds a new sensor Type to table -> types; body: {"sensorType" : "SENSOR_TYPE", "unit" : "UNIT", "repetitions": NUMBER, "sleepTime": NUMBER}
PUT /sensors/types //updates a sensorType or/and unit; body: {"sensorType": "SENSOR_TYPE", "unit": "UNIT", "repetitions": NUMBER, "brakeTime": NUMBER, "sleepTime": NUMBER}
DELETE /sensors/types/{sensorTypeID} //deletes a row from types with this sensorTypeID. If in use by a sensor, it gets the default sensorTypeID = 0. sensorTypeID=0 can not be deleted;
other
----------------------
GET /display/graph?sensorID={id}&date1={date1}&date2={date2} //returns a maximum of 250 date, value (both arrays have the same length) Values averaged in between the given date range to display as graph; result: {"values" :[0,1,..], "dates": ["date1", "date2", ...]}