β¨ Improvements
- Samples in the API now also returns light data.
π Documentation
- The website has been updated with swagger documentation, the swagger was previously hosted in accounts.airthings.com. It can now be found here: API documentation.
β¨ Improvements
Setting up API clients has been moved from accounts.airthings.com to dashboard.airthings.com/integrations and is now part of the Airthings for Business dashboard. This can be accessed for all business users. If you are not yet an Airthings for Business user and want access, please reach out to Airthings for Business Support.
β¨Improvement
Setting up Webhooks has been moved from accounts.airthings.com to dashboard.airthings.com/integrations and is now part of the Airthings for Business dashboard. This can be accessed for all business users. If you are not yet an Airthings for Business user and want access, please reach out to Airthings for Business Support.
π₯ Breaking Change
Graduating Airthings REST API from Beta
Over the last few months we have been iterating the Airthings REST API together with our passionate early users. We have received a lot of valuable feedback and implemented updates accordingly.
With this release we are graduating the Airthings REST API from Beta. The motivation for the changes in this update is to improve consistency and usability of the API. We do not foresee any more breaking changes, and potential future breaking changes will result in a version update of the API.
The Swagger documentation has been updated to reflect these changes. Play with the new version, and download it here. (API documentation will be updated as well).
The API will be updated on 2019-11-25.
We hope that the changes do not cause you any inconvenience. Please reach out to Airthings for Business Support for any clarifications or with any questions.
β¨ Improvements
Planned changes (swagger-diff):
- new endpoints for getting location and latest sample of all devices in a location
- get /locations/{}
- get /locations/{}/latest-samples
- new response attributes
- get /devices
- new attribute in response: segment/id (in: body, type: string)
- new attribute in response: segment/name (in: body, type: string)
- new attribute in response: location/id (in: body, type: string)
- new attribute in response: location/name (in: body, type: string)
- get /devices/{}
- new attribute in response: segment/id (in: body, type: string)
- new attribute in response: segment/name (in: body, type: string)
- new attribute in response: location/id (in: body, type: string)
- new attribute in response: location/name (in: body, type: string)
- get /locations
- new attribute from response: locations[]/name (in: body, type: string). This replaces removed attribute locations[]/locationName
- get /segments
- new attribute in response: segments[]/deviceId (in: body, type: string). This replaces removed attribute segments[]/serialNumber
- new attribute in response: location/id (in: body, type: string)
- new attribute in response: location/name (in: body, type: string)
- get /devices
Example GET /segments endpoint:
- locationName is replaced by an object.
- serialNumber is deviceId.
The old vs. new response from the GET /segments endpoint:
{
"segments": [
{
"id": "f3f247b7-829b-427e-8add-b9d58e94ba75",
"started": "2032-02-05T23:57:12Z",
"ended": "2019-07-23T10:05:45Z",
"name": "Bedroom",
"locationId": "3cc69a8b-5b51-416f-8e01-31ccc7fbda9b",
"serialNumber": "2930999999"
}
]
}
{
"segments": [
{
"id": "f3f247b7-829b-427e-8add-b9d58e94ba75",
"started": "2032-02-05T23:57:12Z",
"ended": "2019-07-23T10:05:45Z",
"name": "Bedroom",
"location": {
"id": "3cc69a8b-5b51-416f-8e01-31ccc7fbda9b",
"name": "Home"
},
"deviceId": "2930999999"
}
]
}
Example GET /locations endpoint:
The old vs. new response from GET /locations:
{
"locations": [
{
"id": "b4e8231b-672f-4e75-b7f0-04ccbd499508",
"locationName": "Drammensveien 288"
}
]
}
{
"locations": [
{
"id": "b4e8231b-672f-4e75-b7f0-04ccbd499508",
"name": "Drammensveien 288"
}
]
}
π Documentation
The developer documentation has been updated with tutorials on how to use the Airthings API. This includes two guides on how to fetch your Airthings data using either python or node.js and a guide for setting up an automatic SMS messaging service by combining Twillio and Airthings webhooks. The former two guides will help you register your application and provide a starting point for developing an Airthings integrated solution, whereas the latter guide can be utilized to send SMS notifications in the case a threshold value is breached, such as high radon levels or high temperatures.
π Feature Release
The authentication capabilities of the API have been extended to support an OAuth2 Client Credentials grant for machine-to-machine usage.
Select Client Credentials as flow type when creating/updating your API Client in the Dashboard. Then you should be able to use the client_id and secret of the client to obtain an access token.
curl -X POST \
https://accounts-api.airthings.com/v1/token \
-H 'Content-Type: application/json' \
-d '{
"grant_type":"client_credentials",
"client_id":"b8a19a7d-64cd-4281-xxxx-xxxxxxxxxxxx",
"client_secret":"82bfed8b-793a-4423-xxxx-xxxxxxxxxxxx"
}'
{
"access_token": "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjMTQ4ODQ1ZC0zNDc4LTRkYjAtOGI2My0yM2QxNGU5Y2EwYWMiLCJhdWQiOiJiOGExOWE3ZC02NGNk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