Add trigger
Request format: POST
URL: http://api.onenet.hk.chinamobile.com/triggers
http body parameter
Name |
Format |
Required or not |
Description |
title |
string |
Yes |
Trigger name |
ds_id |
string |
Yes |
Data stream name |
dev_ids |
array- string |
No |
Device ID, indicating all devices by default |
url |
string |
Yes |
Alarm notification address |
type |
string |
Yes |
Trigger conditions. See the type description list. |
threshold |
|
Yes |
Trigger condition threshold, used in conjunction with type, see the type description list. |
type description list
type |
Description |
> |
The threshold must be a number. |
\< |
The threshold must be a number. |
>= |
The threshold must be a number. |
\<= |
The threshold must be a number. |
inout |
If the threshold is set to {“lolmt”:40, “uplmt”:52}, it means that data will be triggered when sent to or from the closed interval [40, 52]. |
change |
The threshold parameter is not transmitted. In case of change in the uploaded value, an alarm will be triggered. |
frozen |
The threshold is a numerical value, specifying the time (in seconds) of triggering an alarm in case of no data and enabling the frozen status of the monitored object. |
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. “succ” means the call is successful. |
data |
json |
Device-related information returned after interface is successfully called. See the Data Description Table. |
Data Description Table
Name |
Format |
Description |
trigger_id |
int |
Trigger ID |
POST http://api.onenet.hk.chinamobile.com/triggers HTTP/1.1
Request parameter example
{
"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
}
]
}