Added quick endpoint docs
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
|||||||
.idea
|
.idea
|
||||||
/node_modules
|
webapp/node_modules
|
||||||
climate-server
|
climate-server
|
||||||
|
|||||||
48
docs.md
48
docs.md
@@ -0,0 +1,48 @@
|
|||||||
|
# Quick Documentation
|
||||||
|
|
||||||
|
Available endpoints:
|
||||||
|
|
||||||
|
- `GET /<root>`
|
||||||
|
- Display the chart homepage, by default the chart will show the last 60 minutes, updating every 30 seconds.
|
||||||
|
- `GET /<root>?show-minutes=120`
|
||||||
|
- Display the chart homepage, overriding the default 60 minutes to the desired number.
|
||||||
|
- `POST /<root>`
|
||||||
|
- Submit a snapshot to the database in the format of the following example JSON:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"time": "2020-11-13 22:20:44.651953",
|
||||||
|
"temp": 25.2,
|
||||||
|
"humidity": 65.4,
|
||||||
|
"co2": 450
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- `GET /<root>/data`
|
||||||
|
- Retrieve a json of data snapshots over the last 60 minutes in the following format:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"snapshots": [
|
||||||
|
{
|
||||||
|
"id": 8868,
|
||||||
|
"time": "2020-11-13 20:00:12",
|
||||||
|
"temp": 21.7,
|
||||||
|
"humidity": 57.3,
|
||||||
|
"co2": 958
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 8867,
|
||||||
|
"time": "2020-11-13 19:59:42",
|
||||||
|
"temp": 21.7,
|
||||||
|
"humidity": 57.3,
|
||||||
|
"co2": 957
|
||||||
|
},
|
||||||
|
// ...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- `GET /<root>/data/now`
|
||||||
|
- In the same format as above, retrieve the latest snapshot.
|
||||||
|
- `GET /<root>/data?since=2006-01-02T15:04:05Z`
|
||||||
|
- In the same format as above, retrieve all snapshots recorded since the given ISO date.
|
||||||
|
|||||||
Reference in New Issue
Block a user