property.batch

The property.batch command is used to publish batch property data.  For more information about properties see Understanding properties.

Publishes are executed sequentially. If any of the individual data publishes fail with an error, the error will be immediately returned and sequential publishing terminates without completion.

When the deDuplicate flag is set to true for the property key in the thing definition for the thing, any duplicate entries (an entry is considered a duplicate if it has the same timestamp of an existing or previously encountered publish regardless of value) will be ignored. The property will not be updated, no triggers will be fired, and no aggregation will be done for the duplicate.

TR50 Request

{
  "cmd": {
    "command": "property.batch",
    "params": {
      "thingKey": "mything",
      "key": "myp",
      "ts" : "2018-04-05T02:03:04.322Z",
      "corrId": "mycorrid",
      "aggregate":true,
      "data": [
        {
          "key": "myprop",
          "value": 123.44,
          "ts": "2018-04-05T02:03:04.322Z",
          "corrId": "mycorrid"
        },
        {
          "key": "myprop2",
          "value": 42.12,
          "ts": "2018-04-05T02:03:04.322Z",
          "corrId": "mycorrid"
        }
      ]
    }
  }
}

If a Scale is defined in the thing definition property for the thing, when a property.batch is executed, the equation will be applied and the resulting value will be stored.

Request Parameters

Name Type Required Description
thingKey String Yes* The thing key.
thingid String Id of the thing
esn String ESN of the connection.
iccid String ICCID of the connection.
imei String IMEI of the connection.
imsi String IMSI of the connection.
meid String MEID of the connection.
msisdn String MSISDN of the connection.
*One of the above parameters is required to identify the thing. If omitted, the thingKey associated with your session will be used.
key String Property key to use for all data records that do not specify a "key" parameter.
ts String Timestamp to use for all data records that do not specify a "ts" parameter.
corrid String Correlation ID to use for all data records that do not specify a "corrId" parameter.
aggregate Boolean If 'true', then aggregate data (hourly and daily) will be generated for the values published in this API call, if 'false' only the history will be saved.
If not set, then the Calculate aggregates parameter in the property definition in the thing definition for the thing is used.

data

Array

Array of publish objects.

Request Publish Object

Name Type Required Description
key String Yes The key for the property that you want to publish.
value Integer The value to publish. Defaults to 0.
ts String The timestamp at which the value was recorded. Defaults to the top level "ts" parameter, if not specified, then the current timestamp will be used.
corrId String A correlation ID that can be used when querying to find related data objects.

TR50 Response

If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.

{
  "cmd": {
    "success": true
  }
}