Measure Message Format (JSON)

After a device has been successfully registered and a certain sensor has been assigned, the device can start sending messages that conform to a capability defined for the respective sensor type.

The schema of a valid measure message format looks as follows:

Single Measures

The schema of a valid message with a single measure that is sent to the IoT Gateway cloud looks as follows: The payload includes a message that conforms to a capability with the alternate ID capability1. The measures are for the sensor with the alternate ID sensor1. The measure contains three properties, namely Humidity, Temperature, and Status. These fields are part of the respective capability definition.
It is possible to send the measure properties in any order and leave out values that are unknown.

Timestamp

For each measure, the timestamp can be reported. Device Connectivity use timestamp to order the measurement samples returned by Device Connectivity API. If a timestamp is not specified in the ingestion payload, the time of arrival of the message will be referenced.

The timestamp can be provided in two ways:
  • Message Timestamp

    As described in the schema above, you can specify the ingestion time for the whole message through the property timestamp. Both formats, ISO 8601 and a Unix time in milliseconds from epoch (that is a 13-digit number), are allowed.
  • Measure Timestamp

    If you have modeled a capability with a property of type date, you can use it to specify the measure timestamp (that is the timestamp of the sample).
    Both formats, ISO 8601 and a Unix time in milliseconds from epoch (that is a 13-digit number), are allowed.

Looking at the example above, the payload includes a message that conforms to a capability with alternate ID capability2. The measures are for the sensor with the alternate ID sensor2. The measure contains three properties, namely Pressure, Temperature, and Timestamp (with the property Timestamp of type date). These fields are part of the respective capability definition.

Modeling a property of type date is useful if:
  • You want to use one of the properties of the device as timestamp of the measure.

  • You want to send a single message with batched measures, for example, a message containing more samples for the capability, each one with a different timestamp (as for a default time series).

Batched Measures

It is possible to send multiple measures that conform to the same capability in a single message.

Timestamp

  • Message Timestamp

    If you specify the timestamp as message timestamp, it will be applied to all the samples (for example, in this case both, the first and the second samples, will have the same ingestion timestamp 1413191650000)

  • Measure Timestamp

    • If you have modeled a property as type date, its value will result in the ingestion timestamp of each sample on the platform.

      For example, in this case you have two samples, the first one with 1413191650000 as ingestion timestamp and the second one with 1413191790000.

    • If you have specified a _time property, without having modeled it as a property of the capability, its value will result in the ingestion timestamp of each sample on the platform.

      For example, in this case you have two samples, the first one with 1413191650000 as ingestion timestamp and the second one with 1413191790000.

Compressed Single Measures

It is possible to compress the measures by omitting the field names. In this case, the measures array is an array of arrays and the order must match the order of the properties in the capability definition.
It is also possible to send null values for properties for which no values exist.

Compressed Batched Measures

It is possible to send multiple measures with the compressed format (array) in a single message.

Batched Measure Messages

It is possible to send a batch of messages that conform to different capabilities. In this case, the batch contains an array of messages.

Measures for the Auto-Onboarding of Sensors

It is possible to auto-onboard sensors during the data ingestion. Auto-onboarding means that sensors that do not exist are created automatically during data ingestion. In this case, an additional attribute, namely the sensorTypeAlternateId, must be passed. If the sensor with the given sensorAlternateId does not exist, a new sensor is created for the device that is assigned to the sensor type with this sensorTypeAlternateId.