Add new trigger
Request format: POST
URL: http(s)://api.heclouds.com/triggers
I only want to see examples!!!
http request parameter
| Parameter Name | Format | Required? | Description |
| title | string | Yes | Trigger name |
| ds_id | string | No | Optional, data flow name; the data flow name is composed of {obj_id}_{obj_inst_id}_{res_id} |
| dev_ids | array-string | No | Optional, device ID |
| ds_uuids | array-string | No | Optional, data flow uuid |
| url | string | Yes | Alarm notification address |
| type | string | Yes | Trigger conditions. See the type description list. |
| threshold | | Yes | Threshold value of trigger conditions, used together with type; see type description list. |
Parameter description
1. Trigger meaning: when the data point within the specified range meets the trigger condition
2. The trigger has three trigger modes.
1)If ds_id is separately specified in the request parameter, and other parameters are not included, under the current item, all data will enter the trigger judgment logic;
2)If ds_uuids data array is separately specified in the request parameter, only the specified data flows will enter the trigger judgment logic;
3)If ds_id and dev_ids are specified in the request parameter, only the data flow of the specified devices will enter the trigger judgment logic;
type description table
| type | Description |
| > | The threshold must be a number. |
| < | The threshold must be a number. |
| >= | The threshold must be a number. |
| <=< td=""> | The threshold must be a number. | =<>
| inout | If threshold is set to be{"lolmt" 40 "uplmt" 52}, this means it will be triggered when the data value enters or leaves the closed interval [ 40, 52]. |
| change | threshold parameters need not be transferred; the alarm will be triggered when the uploaded value is changed. |
| frozen | The threshold is a value specifying the seconds within which data are not reported and the alarm is triggered, and meanwhile, the monitored object is frozen. |
| live | The threshold is a numeric value, specifying the time required to trigger an alarm after data reporting |
Return Parameters
| Name | Format | Description |
| errno | int | Call error code, where 0 means success. |
| error | string | Error description, where "succ" means success. |
| data | json | Device dependent message returned after the interface is successfully invoked; see Data Description Table |
Data Description Table
| Name | Format | Description |
| trigger_id | int | Trigger ID |
Example of request header
POST http://api.heclouds.com/triggers HTTP/1.1
api-key: YHC**************VqKA=
Example of request parameter
{
"title": "trigger",
"ds_id": "gps",
"url": "http://aoic.choqf.com",
"type": ">",
"threshold": 100
}
Return example
{
"errno":0,
"data": {
"trigger_id":123809
},
"error":"succ"
}
Example of trigger data
{
"trigger": {
"id": 123809,
"threshold": 9.0,
"type": ">"
},
"current_data": [{
"dev_id": "2656",
"ds_id": "gps",
"ds_uuid": "FWEF-ZFW-ZFW-ZFWW",
"at": "2009-09-07T12:16:02.001403Z",
"value": 100
}
]
}