-
Notifications
You must be signed in to change notification settings - Fork 0
API
bartekl1 edited this page Mar 23, 2024
·
2 revisions
GET /api/current_readings
The response is in JSON format.
Key | Type | Description |
---|---|---|
status |
string |
Response status. In case of success ok , and in case of error error . The status ok does not mean that there was no sensor error. |
date |
string |
Reading date in ISO format in universal time (UTC). |
temperature |
float , null
|
Temperature or null in case of sensor error. |
humidity |
integer , null
|
Humidity or null in case of sensor error. |
pressure |
integer , null
|
Pressure or null in case of sensor error. |
dewpoint |
float , null
|
Dew point or null in case of sensor error. |
pm1.0 |
integer , null
|
PM 1.0 or null in case of sensor error. |
pm2.5 |
integer , null
|
PM 2.5 or null in case of sensor error. |
pm10 |
integer , null
|
PM 10 or null in case of sensor error. |
aqi |
integer , null
|
Air quality index or null in case of sensor error. |
Example response:
{
"status": "ok",
"date": "2024-01-19T18:08:29.533089",
"temperature": -1.5,
"humidity": 77,
"pressure": 1006,
"dewpoint": -5,
"pm1.0": 2,
"pm2.5": 4,
"pm10": 4,
"aqi": 3
}
GET /api/archive_readings
Parameters:
Key | Description |
---|---|
start_date | Start date in ISO format in universal time (UTC). |
end_date | End date in ISO format in universal time (UTC). |
all | If set to true returns all readings. |
Parameters start_date
and end_date
or all
parameter must be specified.
The response is in JSON format.
Key | Type | Description |
---|---|---|
status |
string |
Response status. In case of success ok , and in case of error error . |
readings |
list |
List of readings. Every reading has following keys: date , temperature , humidity , pressure , dewpoint , pm1.0 , pm2.5 , pm10 , aqi . |
Example request:
GET /api/archive_readings?start_date=2024-03-22&end_date=2024-03-22
Response for above request:
{
"status": "ok",
"readings": [
{
"temperature": 8.6,
"humidity": 83,
"pressure": 1008,
"pm1.0": 0,
"pm2.5": 1,
"pm10": 1,
"dewpoint": 5.9,
"aqi": 0,
"date": "2024-03-22T00:00:00"
},
...
{
"temperature": 9.3,
"humidity": 88,
"pressure": 997,
"pm1.0": 1,
"pm2.5": 2,
"pm10": 2,
"dewpoint": 7.4,
"aqi": 1,
"date": "2024-03-22T23:00:00"
}
]
}
GET /api/archive_readings/download/<format>
Available formats:
Format | Name |
---|---|
json |
JSON |
csv |
CSV |
sql |
SQL |
yaml |
YAML |
xml |
XML |
excel |
Microsoft Excel |
Parameters:
Key | Description |
---|---|
start_date | Start date in ISO format in universal time (UTC). |
end_date | End date in ISO format in universal time (UTC). |
all | If set to true returns all readings. |
format | If set to true returns formatted file. Only json and xml formats. |
Parameters start_date
and end_date
or all
parameter must be specified.
Example requests:
GET /api/archive_readings/download/json?start_date=2024-03-22&end_date=2024-03-22
GET /api/archive_readings/download/csv?all=true
GET /api/archive_readings/download/xml?start_date=2024-03-22&end_date=2024-03-22&format=true