CanAirIO fixed stations API for fetch published data

CanAirIO Unified API

We have two alternatives to retrieve stations data, using two output protocols:

Basic Output

We have a basic REST API for our CanAirIO fixed stations, for now it only has two endpoints, the first one for get all current stations that are online right now with the last publication, stations and the second one for retrieve the complete data of each station in the last hour:

Stations list

endpoint: http://api.canair.io:8080/stations

Sample request for retreive all stations IDs and its last data:

curl -G http://api.canair.io:8080/stations

sample output

Here, you should have a list of all stations and the last data of each one. The important thing here is the IDs, for in the next step, retrieve the all data of this station.

Station data

endpoint: http://api.canair.io:8080/stations/station_id

Request sample for station with id: U33TTGOTDA585E:

curl -G http://api.canair.io:8080/stations/U33TTGOTDA585E

sample output

DarwinCore Output

Similar than the basic output protocol endpoints, you are able to retrieve these endpoints using dwc API controller, to retrieve the data formatted unsing the DarwinCore standard protocol, like this:

Stations list

endpoint: http://api.canair.io:8080/dwc/stations

Sample request for retreive all stations IDs and its last data:

curl -G http://api.canair.io:8080/dwc/stations

here you should have a list of all stations and the last data of each one. The important thing here is the IDs, for in the next step, retrieve the all data of this station. Here a reduced sample of this list:

[{
	"id": "EZTTTGOTD78432",
	"station_name": "EZTTTGOTD78432",
	"scientificName": "CanAirIO Air quality Station",
	"ownerInstitutionCodeProperty": "CanAirIO",
	"type": "FixedStation",
	"license": "CC BY-NC-SA",
	"measurements": [
		[{
			"measurementID": "2022-03-15T16:29:07.913361Z",
			"measurementType": "PM2.5",
			"measurementUnit": "ug/m3",
			"measurementDeterminedDate ": "2022-03-15T16:29:07.913361Z",
			"measurementDeterminedBy": "CanAirIO station EZTTTGOTD78432",
			"measurementValue": 18
		}, {
			"measurementID": "2022-03-15T16:29:07.913361Z",
			"measurementType": "Geohash",
			"measurementUnit": "",
			"measurementDeterminedDate ": "2022-03-15T16:29:07.913361Z",
			"measurementDeterminedBy": "CanAirIO station EZTTTGOTD78432",
			"measurementValue": "ezty5zs"
		}, {
			"measurementID": "2022-03-15T16:29:07.913361Z",
			"measurementType": "Version",
			"measurementUnit": "",
			"measurementDeterminedDate ": "2022-03-15T16:29:07.913361Z",
			"measurementDeterminedBy": "CanAirIO station EZTTTGOTD78432",
			"measurementValue": "v0.5.2r907"
		}]
	],
	"locationID": "2022-03-15T16:29:07.913361Z",
	"georeferencedBy": "CanAirIO firmware v0.5.2r907",
	"georeferencedDate": "2022-03-15T16:29:07.913361Z",
	"decimalLatitude ": 43.28,
	"decimalLongitude ": -2.99,
	"geohash": "ezty5zs",
	"observedOn": "2022-03-15T16:29:07.913361Z"
}]

Station data

endpoint: http://api.canair.io:8080/dwc/stations/station_id

Request sample for station with id: U33TTGOTDA585E:

curl -G http://api.canair.io:8080/dwc/stations/U33TTGOTDA585E

Sample output for this station:

{
	"id": "U33TTGOTDA585E",
	"station_name": "U33TTGOTDA585E",
	"scientificName": "CanAirIO Air quality Station",
	"ownerInstitutionCodeProperty": "CanAirIO",
	"type": "FixedStation",
	"license": "CC BY-NC-SA",
	"measurements": [
		[{
			"measurementID": "2022-03-15T16:45:34.835070Z",
			"measurementType": "PM2.5",
			"measurementUnit": "ug/m3",
			"measurementDeterminedDate ": "2022-03-15T16:45:34.835070Z",
			"measurementDeterminedBy": "CanAirIO station U33TTGOTDA585E",
			"measurementValue": 5
		}, {
			"measurementID": "2022-03-15T16:45:34.835070Z",
			"measurementType": "Geohash",
			"measurementUnit": "",
			"measurementDeterminedDate ": "2022-03-15T16:45:34.835070Z",
			"measurementDeterminedBy": "CanAirIO station U33TTGOTDA585E",
			"measurementValue": "u33dcu0"
		}, {
			"measurementID": "2022-03-15T16:45:34.835070Z",
			"measurementType": "Version",
			"measurementUnit": "",
			"measurementDeterminedDate ": "2022-03-15T16:45:34.835070Z",
			"measurementDeterminedBy": "CanAirIO station U33TTGOTDA585E",
			"measurementValue": "v0.5.3r908"
		}],
		[{
			"measurementID": "2022-03-15T16:47:34.767315Z",
			"measurementType": "PM2.5",
			"measurementUnit": "ug/m3",
			"measurementDeterminedDate ": "2022-03-15T16:47:34.767315Z",
			"measurementDeterminedBy": "CanAirIO station U33TTGOTDA585E",
			"measurementValue": 5
		}, {
			"measurementID": "2022-03-15T16:47:34.767315Z",
			"measurementType": "Geohash",
			"measurementUnit": "",
			"measurementDeterminedDate ": "2022-03-15T16:47:34.767315Z",
			"measurementDeterminedBy": "CanAirIO station U33TTGOTDA585E",
			"measurementValue": "u33dcu0"
		}, {
			"measurementID": "2022-03-15T16:47:34.767315Z",
			"measurementType": "Version",
			"measurementUnit": "",
			"measurementDeterminedDate ": "2022-03-15T16:47:34.767315Z",
			"measurementDeterminedBy": "CanAirIO station U33TTGOTDA585E",
			"measurementValue": "v0.5.3r908"
		}]
	],
	"locationID": "2022-03-15T16:47:34.767315Z",
	"georeferencedBy": "CanAirIO firmware v0.5.3r908",
	"georeferencedDate": "2022-03-15T16:47:34.767315Z",
	"decimalLatitude ": 52.54,
	"decimalLongitude ": 13.44,
	"geohash": "u33dcu0",
	"observedOn": "2022-03-15T16:47:34.767315Z"
}

Complete Data

You can download the complete database for academic purposes only. Please consider making a donation to help support the maintenance of our infrastructure.

download influxdb backup

To restore the database, please extract the file and execute:

influxd restore -portable -db canairio <path-to-backup>

(Notes: canairio database must not exist. The influxdb version that was use was: 1.11.8-2)

Data visualization

The shared time series of each stations could be listed in our Grafana dashboard:

CanAirIO grafana

Mobile track visualization