alarm.batch

The alarm.batch command is used to publish batch alarm data.  For more information about alarms see Defining Alarms.

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

TR50 Request

{
  "cmd": {
    "command": "alarm.batch",
      "params": {
        "thingKey": "athing",
        "key": "analarm",
        "ts" : "2016-02-26T02:05:04.322Z",
        "corrId": "mycorrid",
        "msg": "A message",
        "lat": 25.77,
        "lng": -80.2,
        "republish": false,
        "state": 0,
        "data": [
          {
            "ts": "2016-02-26T02:07:09.322Z",
            "state": 1,
            "msg": "Here is a message"
          },
          {
            "key": "anotheralarm",
            "ts": "2016-02-26T02:08:04.322Z",
            "lat": 41.38,
            "lng": 2.18
          }
        ]
     }
  }
}

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 connection.
key String See Description Alarm 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. If not specified, then the current timestamp will be used.
corrId String Correlation ID to use for all data records that do not specify a "corrId" parameter.
msg String The message associated with an alarm.
lat Float Latitude of alarm location (+-180 degrees).
lng Float Longitude of alarm location (+-180 degrees).
republish Boolean If the publish is the latest value (ie the timestamp is newer than all other timestamps for the alarm), and republish is false, the publish will be suppressed and will not add an additional record. The default value is false.
state Integer Alarm state. Defaults to 0.
data Array   Array of publish objects.

Request Publish Object

Name Type Required Description
key String The key for the alarm that you wish to publish.
state 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.
corrId String A correlation ID that can be used when querying to find related data objects.
msg String The message associated with an alarm.
lat Float Latitude of alarm location (+-180 degrees).
lng Float Longitude of alarm location (+-180 degrees).
republish Boolean If the publish is the latest value (ie the timestamp is newer than all other timestamps for the alarm), and republish is false, the publish will be suppressed and will not add an additional record. The default value is false.

If two or more alarm states get published with the same time stamp (ts), they will only get published if the states are different, or if the republish flag is set to true.

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
  }
}