Skip to main content

Measurements

You can find detailed information about how catalogs work in our Help center.

Import single measurement

Endpoint

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

  • EU: POST https://analytics-api-eu.piano.io/import/v1/measurements
  • US: POST https://analytics-api-us.piano.io/import/v1/measurements
  • AP: POST https://analytics-api-ap.piano.io/import/v1/measurements

Headers

Authentication

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

Content-Type

  • header name: Content-Type
  • header value: application/json

Payload

The expected payload is a JSON object, following the schema below:

{
"key": "<MEASUREMENT_KEY>",
"period": "<DATE>",
"values": {
"key1": 1,
"key2": 2
},
"properties": {
"property1": "Property value 1",
"property2": "Property value 2"
},
"site_id": 1245695
}

Parameters

ParameterMandatory?TypeComment
keyYESstringMeasurement key
periodYES / NOstring / numberPeriod for the measurement. Local time. See Period format section for available formats. You should use either period or period_utc but it is mandatory to use one.
period_utcYES / NOstring / numberPeriod for the measurement. UTC time. See Period format section for available formats. You should use either period or period_utc but it is mandatory to use one.
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.

Size limits

FeatureLimit
JSON max body size100KB

Import multiple measurements

In order to import multiple measurements, you can use a batch request. To do so, we offer a dedicated endpoint expecting ndJSON (newline-delimited JSON) as payload.

Endpoint

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

  • EU: POST https://analytics-api-eu.piano.io/import/v1/measurements/batch
  • US: POST https://analytics-api-us.piano.io/import/v1/measurements/batch
  • AP: POST https://analytics-api-ap.piano.io/import/v1/measurements/batch

Headers

Authentication

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

Content-Type

  • header name: Content-Type
  • header value: application/x-ndjson

Payload

The expected payload is one-line JSON object per measurement to import, following the schema below:

{"key":"<MEASUREMENT_KEY>","period":"<DATE>","values":{"key1":1,"key2":2},"properties":{"property1":"Property value 1a","property2":"Property value 2a"},"site_id":1245695}
{"key":"<MEASUREMENT_KEY>","period":"<DATE>","values":{"key1":3,"key2":4},"properties":{"property1":"Property value 1b","property2":"Property value 2b"},"site_id":1245695}
{"key":"<MEASUREMENT_KEY>","period":"<DATE>","values":{"key1":5,"key2":6},"properties":{"property1":"Property value 1c","property2":"Property value 2c"},"site_id":1245695}
{"key":"<MEASUREMENT_KEY>","period":"<DATE>","values":{"key1":7,"key2":8},"properties":{"property1":"Property value 1d","property2":"Property value 2d"},"site_id":1245695}

Parameters

ParameterMandatory?TypeComment
keyYESstringMeasurement key
periodYES / NOstring / numberPeriod for the measurement. Local time. See Period format section for available formats. You should use either period or period_utc but it is mandatory to use one.
period_utcYES / NOstring / numberPeriod for the measurement. UTC time. See Period format section for available formats. You should use either period or period_utc but it is mandatory to use one.
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

We highly recommend using NDJSON over JSON for your measurements ingestion.

Size limits

FeatureLimit
ndJSON max body size1GB
ndJSON max line size100KB

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

Notes:

  • Use period for local time, or period_utc for UTC time. Exactly one of them is required.

Volume limits

Global volume limits (maximum number of ingested measurements):

  • Minute granularity: 100 per minute, 140 000 per day
  • Hour granularity: 1 000 per hour, 24 000 per day
  • Day granularity: 100 000 per day
  • Month granularity: 100 000 per month