Skip to main content

Measurements

Endpoint

Depending on your organization's region, you will need to send your measurements to the corresponding endpoint:

EU: https://analytics-api-eu.piano.io/import/measurements/v1

US: https://analytics-api-us.piano.io/import/measurements/v1

Authentication

  • header name: x-api-key
  • header value: an API key from your profile in the solution with the following pattern: <ACCESSKEY>_<SECRETKEY>

Payload

Parameters

ParameterMandatory?TypeComment
keyYESstringMeasurement key
periodYESstring / numberPeriod for the measurement. Local time. See here for available formats
valuesYESobjectMeasurement values
propertiesNOobjectList of analytics properties to cross data with
site_idYES / NOintSite ID. Mandatory for site-scoped measurements, must not be present for orga-scoped
tip

You can find a measurement example in your Data Management interface.

period Format

Depending on your measurement's configured periodicity, you must use the corresponding format:

PeriodicityFormat
MinuteYYYY-MM-DDTHH:MM:00
HourYYYY-MM-DDTHH:MM:00
DayYYYYMMDD or YYYY-MM-DD
MonthYYYYMMDD or YYYY-MM-DD

Limits

FeatureLimit
JSON max body size100KB
NDJSON max body size1GB
NDJSON max measurement size100KB

NDJSON

tip

We highly recommend using NDJSON over JSON for your measurements ingestion

Content-type

application/x-ndjson

Body with site_id

{"key": "temperature", "period": "2023-01-01T12:00:00", "values": {"celsius": 25.5, "fahrenheit": 77.9}, "properties": {"geo_city": "Paris", "probe": "Siemens"}, "site_id": 1245695}
{"key": "temperature", "period": "2023-01-01T12:00:00", "values": {"celsius": 35.5, "fahrenheit": 95.9}, "properties": {"geo_city": "Bordeaux", "probe": "Siemens"}, "site_id": 1245695}

Body without site_id

{"key": "temperature", "period": "2023-01-01T12:00:00", "values": {"celsius": 25.5, "fahrenheit": 77.9}, "properties": {"geo_city": "Paris", "probe": "Siemens"} }
{"key": "temperature", "period": "2023-01-01T12:00:00", "values": {"celsius": 35.5, "fahrenheit": 95.9}, "properties": {"geo_city": "Bordeaux", "probe": "Siemens"} }

JSON

Content-type

application/json

Body with site_id

{
"measurements": [
{
"key": "temperature",
"period": "2023-01-01T12:00:00",
"values": {
"celsius": 25.5,
"fahrenheit": 77.9
},
"properties": {
"geo_city": "Paris",
"probe": "Siemens"
},
"site_id": 1245695
},
{
"key": "temperature",
"period": "2023-01-01T12:00:00",
"values": {
"celsius": 35.5,
"fahrenheit": 95.9
},
"properties": {
"geo_city": "Bordeaux",
"probe": "Siemens"
},
"site_id": 1245695
}
]
}

Body without site_id

{
"measurements": [
{
"key": "temperature",
"period": "2023-01-01T12:00:00",
"values": {
"celsius": 25.5,
"fahrenheit": 77.9
},
"properties": {
"geo_city": "Paris",
"probe": "Siemens"
}
},
{
"key": "temperature",
"period": "2023-01-01T12:00:00",
"values": {
"celsius": 35.5,
"fahrenheit": 95.9
},
"properties": {
"geo_city": "Bordeaux",
"probe": "Siemens"
}
}
]
}