Get historical readings for a public device
GET
/public/devices/{id}/historical
const url = 'https://localhost:8080/api/v1/public/devices/example/historical?timeline=daily';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://localhost:8080/api/v1/public/devices/example/historical?timeline=daily'Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string
Device id (UUID)
Query Parameters
Section titled “Query Parameters”timeline
required
string
Timeline
Responses
Section titled “Responses”OK
Media typeapplication/json
object
data
Array<object>
object
label
string
metrics
object
aqi
integer
heat_index
number
humidity
number
pm1_0
number
pm2_5
number
pm10_0
number
temperature
number
timestamp
string
timeline
string
Example
{ "timeline": "daily"}Not Found
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}Unprocessable Entity
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}Internal Server Error
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}