Sensor Service API

Versie 1.1.0 · openapi.json

Read-only API for projects, devices, sensors and measurements.

Authenticate with an API key made under Instellingen > API-sleutels: a key of the OAuth kind is exchanged for a bearer token at `/api/v1/oauth/token`; a key of the Bearer kind is sent as `Authorization: Bearer ak_...` itself.

A key reads the projects of its workspace, all of them or the ones in its scope.

Measurements: one request covers at most 366 days and returns at most 100000 rows.

Authentication

Tokens for keys of the OAuth kind.

POST/api/v1/oauth/token

Issue a token

OAuth2 client credentials: `client_id` is the key's name, `client_secret` the key. The token is valid for 15 minutes; a revoked key stops its tokens at once.

Body (application/x-www-form-urlencoded)

grant_typestring (client_credentials)
client_idstringName of the key
client_secretstringThe key (`ak_...`)

Responses: 200 Token — Token400 Invalid request401 Invalid client credentials

Token

access_tokenstring
token_typestring (Bearer)
expires_inintegerSeconds
scopestringProject codes, or `all`

Projects

GET/api/v1/projects

List projects

Responses: 200 Projects, by name — Project[]401 Unauthorized

Project

project_idinteger
project_codestring
project_namestring
descriptionstring, nullable
contract_end_datestring (date-time), nullable
start_datestring (date-time), nullable
end_datestring (date-time), nullable
locationstring, nullable`<lat>, <lon>`
latitudenumber, nullable
longitudenumber, nullable
device_countinteger
sensor_countinteger

GET/api/v1/projects/{project_id}

Get a project

ParameterInType
project_id *pathintegerProject id

Responses: 200 The project with its settings and build-up — ProjectDetail400 Bad request401 Unauthorized404 Not found

ProjectDetail

project_idinteger
project_codestring
project_namestring
descriptionstring, nullable
contract_end_datestring (date-time), nullable
start_datestring (date-time), nullable
end_datestring (date-time), nullable
locationstring, nullable`<lat>, <lon>`
latitudenumber, nullable
longitudenumber, nullable
device_countinteger
sensor_countinteger
settingsProjectSetting[]
layersProjectLayer[]

Project

project_idinteger
project_codestring
project_namestring
descriptionstring, nullable
contract_end_datestring (date-time), nullable
start_datestring (date-time), nullable
end_datestring (date-time), nullable
locationstring, nullable`<lat>, <lon>`
latitudenumber, nullable
longitudenumber, nullable
device_countinteger
sensor_countinteger

ProjectSetting

setting_idinteger
project_idinteger
settingstring
descriptionstring, nullable

ProjectLayer

One layer of the roof build-up, from the top down

positioninteger0 is the top layer
layer_typestring (vegetatie | afstrooi | bovensubstraat | ondersubstraat | filterlaag | drainage_retentie | beschermlaag)
materialstring, nullable
substrate_idinteger, nullableCatalogue material, when the layer uses one
height_cmstring, nullableNumeric as text

GET/api/v1/projects/{project_id}/layers

Get the build-up (opbouw) of a project

ParameterInType
project_id *pathintegerProject id

Responses: 200 The layers from the top down, with the total height — ProjectLayers400 Bad request401 Unauthorized404 Not found

ProjectLayers

project_idinteger
project_codestring
countinteger
total_height_cmstringSum of the layer heights, numeric as text
layersProjectLayer[]

ProjectLayer

One layer of the roof build-up, from the top down

positioninteger0 is the top layer
layer_typestring (vegetatie | afstrooi | bovensubstraat | ondersubstraat | filterlaag | drainage_retentie | beschermlaag)
materialstring, nullable
substrate_idinteger, nullableCatalogue material, when the layer uses one
height_cmstring, nullableNumeric as text

GET/api/v1/projects/{project_id}/devices

List the devices of a project

ParameterInType
project_id *pathintegerProject id

Responses: 200 Devices, by name — Device[]400 Bad request401 Unauthorized

Device

device_idinteger
project_idinteger
device_namestring
descriptionstring, nullable
installation_descriptionstring, nullable
brandstring, nullable
serial_numberstring, nullable
installation_settingsstring, nullable
dev_euistring, nullable
dev_addrstring, nullable
administratorstring, nullable
start_datestring (date-time), nullable
end_datestring (date-time), nullable
typeinteger, nullableDevice type id
public_idstringId of the public page `/d/{public_id}`
latitudenumber, nullable
longitudenumber, nullable
project_codestring
project_namestring
sensor_countinteger
sensorsSensorSummary[]

SensorSummary

sensor_idinteger
parameter_namestring
unitstring

Devices

GET/api/v1/devices

List devices

ParameterInType
serial_numberquerystringPart of the serial number
brandquerystringPart of the brand

Responses: 200 Devices, by name — Device[]401 Unauthorized

Device

device_idinteger
project_idinteger
device_namestring
descriptionstring, nullable
installation_descriptionstring, nullable
brandstring, nullable
serial_numberstring, nullable
installation_settingsstring, nullable
dev_euistring, nullable
dev_addrstring, nullable
administratorstring, nullable
start_datestring (date-time), nullable
end_datestring (date-time), nullable
typeinteger, nullableDevice type id
public_idstringId of the public page `/d/{public_id}`
latitudenumber, nullable
longitudenumber, nullable
project_codestring
project_namestring
sensor_countinteger
sensorsSensorSummary[]

SensorSummary

sensor_idinteger
parameter_namestring
unitstring

GET/api/v1/devices/{device_id}

Get a device with its sensors

ParameterInType
device_id *pathintegerDevice id

Responses: 200 The device — DeviceDetail400 Bad request401 Unauthorized404 Not found

DeviceDetail

device_idinteger
project_idinteger
device_namestring
descriptionstring, nullable
installation_descriptionstring, nullable
brandstring, nullable
serial_numberstring, nullable
installation_settingsstring, nullable
dev_euistring, nullable
dev_addrstring, nullable
administratorstring, nullable
start_datestring (date-time), nullable
end_datestring (date-time), nullable
typeinteger, nullableDevice type id
public_idstringId of the public page `/d/{public_id}`
latitudenumber, nullable
longitudenumber, nullable
project_codestring
project_namestring
sensor_countinteger
sensorsobject

Device

device_idinteger
project_idinteger
device_namestring
descriptionstring, nullable
installation_descriptionstring, nullable
brandstring, nullable
serial_numberstring, nullable
installation_settingsstring, nullable
dev_euistring, nullable
dev_addrstring, nullable
administratorstring, nullable
start_datestring (date-time), nullable
end_datestring (date-time), nullable
typeinteger, nullableDevice type id
public_idstringId of the public page `/d/{public_id}`
latitudenumber, nullable
longitudenumber, nullable
project_codestring
project_namestring
sensor_countinteger
sensorsSensorSummary[]

SensorSummary

sensor_idinteger
parameter_namestring
unitstring

Sensor

sensor_idinteger
device_idinteger
project_idinteger
parameter_idinteger
descriptionstring, nullable
latitudestring, nullableNumeric as text
longitudestring, nullableNumeric as text
start_datestring (date-time), nullable
end_datestring (date-time), nullable
project_codestring
project_namestring
device_namestring
parameter_namestring
unitstring
last_valuestring, nullableOnly with `last_value=true`
last_measurement_atstring (date-time), nullable

Sensors

GET/api/v1/sensors

List sensors

ParameterInType
device_idqueryinteger
parameter_idqueryinteger
project_idqueryinteger
last_valuequerybooleanAdd the latest value and its time

Responses: 200 Sensors, by project, device and id — Sensor[]400 Bad request401 Unauthorized

Sensor

sensor_idinteger
device_idinteger
project_idinteger
parameter_idinteger
descriptionstring, nullable
latitudestring, nullableNumeric as text
longitudestring, nullableNumeric as text
start_datestring (date-time), nullable
end_datestring (date-time), nullable
project_codestring
project_namestring
device_namestring
parameter_namestring
unitstring
last_valuestring, nullableOnly with `last_value=true`
last_measurement_atstring (date-time), nullable

GET/api/v1/sensors/{sensor_id}/measurements

Measurements of a sensor

ParameterInType
sensor_id *pathintegerSensor id
fromquerystring (date-time)Start of the range; default 24 hours before `to`
toquerystring (date-time)End of the range; default now

Responses: 200 Measurements, oldest first — object400 Bad request401 Unauthorized404 Not found

Measurement

measurement_idinteger
sensor_idinteger
device_idinteger
project_idinteger
project_codestring
timestampstring (date-time)
valuestringNumeric as text
locationstring, nullable
cleanedboolean
parameter_idinteger
parameter_namestring
unitstring

GET/api/v1/sensors/{sensor_id}/measurements-extended

Measurements of a sensor, with device and parameter names

ParameterInType
sensor_id *pathintegerSensor id
fromquerystring (date-time)Start of the range; default 24 hours before `to`
toquerystring (date-time)End of the range; default now

Responses: 200 Measurements, oldest first — object400 Bad request401 Unauthorized404 Not found

MeasurementExtended

measurement_idinteger
timestampstring (date-time)
valuestringNumeric as text
locationstring, nullable
sensor_idinteger
parameter_idinteger
parameter_namestring
unitstring
device_idinteger
device_namestring
project_idinteger