API documentation for MIRI Africa
# Miri Africa Platform Open Source API Documentation
### 1. Introduction
Welcome to the **Miri Africa** API documentation. This guide provides information on how to use our RESTful API to retrieve environmental data from our network of devices.
**Base URL:**
opendata.miri.africa
All API requests must be made over HTTPS.
### 2. Authentication
To access the API, you must include a valid api_key in the query parameters of every request. You can obtain your API Key from your account dashboard.
### 3. Endpoints
This section outlines the available endpoints, their corresponding HTTP methods, and their intended purposes.
**3.1. Get All Devices**
`GET /devices`
This method gets a list of all the devices whose data an API can access.
**Query Parameters:**
* `api_key` (required): Your unique API Key.
**Response:**
* `variables` (Array []): Array of all accessible variables.
* `device_id` (String): Unique ID of devices
* `location` (String): Location (in `Latitude, Longitude` format) of specific device
* `name` (String): Name of the device as named by the organization or user
**Sample Request**:
`curl
opendata.miri.africa`
⠀**Success Response (200 OK):**
```
[
{
"variables": [
"temperature",
"pmtwo"
]
},
{
"device_id": "mmmmmmmm",
"location": "x.xxx,y.yyyy",
"name": "Miri Air - Name"
},
{
"device_id": "nnnnnnnnn",
"location": "x.xxx,y.yyyy",
"name": "Miri Air - Name"
}
]
```
**Note:** The device ID (e.g., mmmmmmm) is the value for the query param `device` to be used with the other endpoints.
**3.2. Get Real-Time Data**
`GET /realtime-data`
Retrieves real-time environmental data for a specific device or group of devices.
**Query Parameters:**
* `api_key` (required): Your unique API Key.
* `device` (required): The device ID of the device or devices as a comma-separated list.
* `variables`: A comma-separated list of data variables to retrieve. For a full list of available variables, see **Available Variable …