trigger.template.find

The trigger.template.find command is used to find and return a trigger template.

TR50 Request


{
  "1": {
    "command": "trigger.template.find",
    "params": {
      "id": "53728d6b31004662fe000052"
    }
  }
}
      

Request Parameters

Name

Type

Required

Description

id

String

Yes

The unique identifier to find.

TR50 Response

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


{
    "1": {
        "success": true,
        "params": {
            "id": "53728d6b31004662fe000052",
            "orgId": "534c36e53100460721000051",
            "orgKey": "DEV",
            "name": "Inventory status set template",
            "desc": "Update inventory ",
            "group": "testGroup",
            "naturalDesc": "if [[num]] < inventory, then publish [[thingKey]]",
            "fields": [
                {
                    "key": "num",
                    "type": "number"
                },
                {
                    "key": "thingKey",
                    "type": "string"
                }
            ],
            "trigger": {
                "eventType": "property.change",
                "event": {
                    "edge": "true",
                    "operator": "always",
                    "propKey": "inventorypct"
                },
                "actions": {
                    "0": {
                        "type": "alarm.publish",
                        "params": {
                            "alarmKey": "inventory",
                            "republish": "false",
                            "state": "[[num]]",
                            "thingKey": "[[thingKey]]"
                        },
                        "canvas": {
                            "failure": "failure-end0",
                            "left": "63",
                            "success": "success-end0",
                            "top": "150"
                        },
                        "routes": {
                            "failure": "$endFailure",
                            "success": "$endSuccess"
                        }
                    },
                    "1": {
                        "type": "alarm.publish",
                        "params": {
                            "alarmKey": "inventory",
                            "republish": "false",
                            "state": "1",
                            "thingKey": "$(event.thing.key)"
                        },
                        "canvas": {
                            "failure": "failure-end0",
                            "left": "63",
                            "success": "success-end0",
                            "top": "284"
                        },
                        "routes": {
                            "failure": "$endFailure",
                            "success": "$endSuccess"
                        }
                    },
                    "2": {
                        "type": "alarm.publish",
                        "params": {
                            "alarmKey": "inventory",
                            "republish": "false",
                            "state": "2",
                            "thingKey": "$(event.thing.key)"
                        },
                        "canvas": {
                            "failure": "failure-end0",
                            "left": "62",
                            "success": "success-end0",
                            "top": "407"
                        },
                        "routes": {
                            "failure": "$endFailure",
                            "success": "$endSuccess"
                        }
                    },
                    "3": {
                        "type": "alarm.publish",
                        "params": {
                            "alarmKey": "inventory",
                            "republish": "false",
                            "state": "3",
                            "thingKey": "$(event.thing.key)"
                        },
                        "canvas": {
                            "failure": "failure-end0",
                            "left": "-67",
                            "success": "success-end0",
                            "top": "479"
                        },
                        "routes": {
                            "failure": "$endFailure",
                            "success": "$endSuccess"
                        }
                    },
                    "4": {
                        "type": "math.if",
                        "params": {
                            "expr": "$(event.prop.value)<1.0"
                        },
                        "canvas": {
                            "diamond_failure": "failure-end0",
                            "left": "-69",
                            "top": "57"
                        },
                        "routes": {
                            "failure": "$endFailure",
                            "false": "5",
                            "true": "0"
                        }
                    },
                    "5": {
                        "type": "math.if",
                        "params": {
                            "expr": "$(event.prop.value)<25.0"
                        },
                        "canvas": {
                            "diamond_failure": "failure-end0",
                            "left": "-69",
                            "top": "200"
                        },
                        "routes": {
                            "failure": "$endFailure",
                            "false": "6",
                            "true": "1"
                        }
                    },
                    "6": {
                        "type": "math.if",
                        "params": {
                            "expr": "$(event.prop.value)<50.0"
                        },
                        "canvas": {
                            "left": "-69",
                            "top": "334"
                        },
                        "routes": {
                            "failure": "$endFailure",
                            "false": "3",
                            "success": "$endSuccess",
                            "true": "2"
                        }
                    }
                },
                "firstAction": "4",
                "canvas": {
                    "event": {
                        "left": "-69",
                        "top": "-50"
                    },
                    "failure-end": [
                        {
                            "left": "-169",
                            "top": "564"
                        }
                    ],
                    "success-end": [
                        {
                            "left": "254",
                            "top": "555"
                        }
                    ]
                }
            },
            "createdBy": "user@example.com",
            "createdOn": "2017-05-16T21:22:35.226Z",
            "updatedBy": "user@example.com",
            "updatedOn": "2017-05-16T21:22:35.226Z"
        }
    }
}
      

Response Parameters

Name

Type

Description

id

String

The unique identifier of the trigger template.

orgId

String

The ID of the org.

orgKey

String

The key of the org.

name

String

The name of the trigger template.

desc

String

The description of the trigger template.

group

String

The arbitrary label of the group the template belongs to.

naturalDesc

String

A sentence (or set of sentences) that describe the trigger the template will generate, and how it's variables will be used.

trigger

Array

The template used to create new triggers. For more information, see trigger.create.

createdBy

String

 The creator of this trigger template.

createdOn

String

The creation timestamp of this trigger template.

updatedBy

String

The updater of this trigger template.

updatedOn

String

The update timestamp of this trigger template.