新增告警规则

POST /api/ alarmRule

创建设备实例

请求参数

参数名 类型 必填 描述 限制
alarmTitle string 告警标题 告警标题不能重复
alarmContent string 告警详情
alarmLevel int 告警级别,1:严重 2:警告 3:一般
enable bool 是否激活,true:激活,false:不激活
systemUid string 产品类型,包括:"bi": "BI", "safe": "安全", "quality": "质量", "labor": "劳务", "inspection": "物料"
deviceType string 设备类型
alarmConditions JSONArray 告警条件,可填多个属性的告警条件,每个条件需要指定code:属性名,operator:操作符,==,>,<,>=,<=,value:告警值
tenantId string 空表示所有,可以填入多个租户ID,用逗号分开
projectId string 空表示所有,可以填入多个项目ID,用逗号分开

请求样例

POST /api/v1/devices HTTP/1.1
Host: 60.205.223.53:8443
Content-Type: application/json
Authorization: Bearer xxx.xxxx.xxx
Cache-Control: no-cache
Postman-Token: cadfb57b-9f64-3b55-f3ea-559e8051cd6a

{
    "alarmTitle": "测试告警规则",
    "alarmContent": "",
    "alarmLevel": "1",
    "enable": false,
    "systemUid": "bi",
    "deviceType": "Light",
    "alarmConditions": [{
        "code": "rgbLed",
        "operator": "==",
        "value": "111"
    }],
    "tenantId": "",
    "projectId": ""
}

##

响应样例

{
    "returnCode": 0,
    "result": {
        "createdBy": "admin@site",
        "createdTime": 1574060927346,
        "id": "5dd2437fa7b11b0001a38c55",
        "systemUid": "bi",
        "tenantId": "",
        "projectId": "",
        "deviceType": "Light",
        "alarmTitle": "测试告警规则",
        "alarmContent": "",
        "alarmCondition": "(rgbLed==111)",
        "alarmLevel": 1,
        "enable": false,
        "alarmConditions": [{
            "code": "rgbLed",
            "operator": "==",
            "value": "111"
        }],
        "deleted": false
    }
}