This API allows you to query time-series data of temperature and humidity sensors stored in a database. Below are the details for using the available API endpoints.
The base URL for accessing the API is:
https://api.nasathome.top/data/logger
The following query parameters are used in the API requests:
temp?humidity - Both temperature and humidity
data
If no sensors parameter is provided, the response will include both temperature_status and humidity_status data for all times.
Here are some examples of how to query the API:
Returns status data for the entire database:
https://api.nasathome.top/data/logger
Returns temperature data from 2024/11/01 to
2024/11/21/13:30:
https://api.nasathome.top/data/logger?start=2024/11/01&end=2024/11/21/13:30&sensors=temp
Returns temperature data up to 2024/11/21/12:00:
https://api.nasathome.top/data/logger?end=2024/11/21/12:00&sensors=temp
Returns both temperature and humidity data for the entire database:
https://api.nasathome.top/data/logger?sensors=temp?humidity
If no start or end parameters are provided, the API will return data starting from the beginning or up to the latest available data. For example:
https://api.nasathome.top/data/logger?sensors=humidity
Returns humidity data for the entire database.
The API will return a JSON response with the following structure:
[
{
"time": "2024-11-01 00:00",
"temperature_status": 1,
"humidity_status": 1,
"temperature": 22.5,
"humidity": 60
},
{
"time": "2024-11-01 01:00",
"temperature_status": 1,
"humidity_status": 0,
"temperature": 23.0,
"humidity": 55
},
...
]
The JSON object contains the following fields:
If the request is invalid, the API will return an error response. Example:
{
"error": "Invalid datetime format. Must be yyyy/mm/dd[/hh[:mm]]."
}
Make sure to check the format of the start and end times, as well as the validity of the sensors parameter.