sensors.Africa API
get-auth-token
create
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
username required | Valid username for authentication |
password required | Valid password for authentication |
v1
push-sensor-data > create
This endpoint is to POST data from the sensor to the api.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
sensor | |
sampling_rate | in milliseconds |
timestamp | |
sensordatavalues required | |
software_version | sensor software version |
v2
cities > list
Query Parameters
The following parameters should be included as part of a URL query string.
Parameter | Description |
---|---|
page | A page number within the paginated result set. |
page_size | Number of results to return per page. |
data > list
View for retrieving and downloading detailed sensor data records, with access controlled based on user permissions and ownership. This endpoint allows authenticated users to retrieve sensor data records, with the following access rules: - Users in the `show_me_everything` group have access to all sensor data records. - Other users can access data from sensors they own, sensors owned by members of their groups, or public sensors. - Non-authenticated users can only access public sensor data.
Query Parameters
The following parameters should be included as part of a URL query string.
Parameter | Description |
---|---|
next_page | The pagination cursor value. |
sensor | |
sensor__public | |
location__country | |
location__city | |
timestamp__gte | |
timestamp__lte |
data > read
View for retrieving and downloading detailed sensor data records, with access controlled based on user permissions and ownership. This endpoint allows authenticated users to retrieve sensor data records, with the following access rules: - Users in the `show_me_everything` group have access to all sensor data records. - Other users can access data from sensors they own, sensors owned by members of their groups, or public sensors. - Non-authenticated users can only access public sensor data.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
id required | A unique integer value identifying this sensor data. |
Query Parameters
The following parameters should be included as part of a URL query string.
Parameter | Description |
---|---|
sensor | |
sensor__public | |
location__country | |
location__city | |
timestamp__gte | |
timestamp__lte |
data > stats > list
View to retrieve summarized statistics for specific sensor types (e.g., air quality) within a defined date range, filtered by city and grouped by specified intervals (hourly, daily, or monthly). **URL Parameters:** - `sensor_type` (str): The type of sensor data to retrieve (e.g., air_quality). **Query Parameters:** - `city` (str, optional): Comma-separated list of city slugs to filter data by location. - `from` (str, optional): Start date in "YYYY-MM-DD" format. Required if `to` is specified. - `to` (str, optional): End date in "YYYY-MM-DD" format. Defaults to 24 hours before `to_date` if unspecified. - `interval` (str, optional): Aggregation interval for results - either "hour", "day", or "month". Defaults to "day". - `value_type` (str, optional): Comma-separated list of value types to filter (e.g., "PM2.5, PM10"). **Caching:** - Results are cached for 1 hour (`@cache_page(3600)`) to reduce server load. **Returns:** - A list of sensor data statistics, grouped by city, value type, and specified interval. - Each entry includes: - `value_type` (str): Type of sensor value (e.g., PM2.5). - `city_slug` (str): City identifier. - `truncated_timestamp` (datetime): Timestamp truncated to the specified interval. - `start_datetime` (datetime): Start of the aggregated time period. - `end_datetime` (datetime): End of the aggregated time period. - `calculated_average` (float): Weighted average of sensor values. - `calculated_minimum` (float): Minimum recorded value within the period. - `calculated_maximum` (float): Maximum recorded value within the period.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
sensor_type required |
Query Parameters
The following parameters should be included as part of a URL query string.
Parameter | Description |
---|---|
page | A page number within the paginated result set. |
page_size | Number of results to return per page. |
locations > list
View for retrieving and creating sensor entries.
Query Parameters
The following parameters should be included as part of a URL query string.
Parameter | Description |
---|---|
page | A page number within the paginated result set. |
page_size | Number of results to return per page. |
sensor-types > list
View for retrieving and creating sensor type entries.
Query Parameters
The following parameters should be included as part of a URL query string.
Parameter | Description |
---|---|
page | A page number within the paginated result set. |
page_size | Number of results to return per page. |
sensors > list
Query Parameters
The following parameters should be included as part of a URL query string.
Parameter | Description |
---|---|
page | A page number within the paginated result set. |
page_size | Number of results to return per page. |