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

 

Thing Identifier Parameters

See note

Identifies the thing to which the alarm data is to be associated. If omitted, the thingKey associated with your session will be used. See Thing Identifier Parameters table below for supported parameters.

If you execute calls with a user session, the thing's identifier is required.

key

String

 

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.

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

Thing Identifier Parameters

Name

Type

Description

thingKey

String

Key of the thing

thingId

String

Id of the thing

esn

String

Esn of the thing

iccid

String

Iccid of the thing

imei

String

Imei of the thing

imsi

String

Imsi of the thing

meid

String

Meid of the thing

msisdn

String

Msisdn of the thing

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.

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