API - V1 live
💥 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"
}
]
}