Add a new rule
POST {{baseUrl}}/rules
Add a new rule for a selection of assets of one asset type. The body of the request contains the rule definition.
Request Body
{"assetType"=>"<string>", "assetIds"=>["<string>", "<string>"], "name"=>"<string>", "description"=>"<string>", "active"=>"<boolean>", "evaluations"=>[{"property"=>"<string>", "condition"=>"<string>", "hysteresisAbsolute"=>{"active"=>"<boolean>", "value"=>"<number>", "lowerValue"=>"<number>", "upperValue"=>"<number>"}, "debouncingTime"=>{"active"=>"<boolean>", "value"=>"<number>"}, "threshold"=>"<integer>", "lowerLimitThreshold"=>"<number>", "upperLimitThreshold"=>"<number>"}, {"property"=>"<string>", "condition"=>"<string>", "hysteresisAbsolute"=>{"active"=>"<boolean>", "value"=>"<number>", "lowerValue"=>"<number>", "upperValue"=>"<number>"}, "debouncingTime"=>{"active"=>"<boolean>", "value"=>"<number>"}, "threshold"=>"<integer>", "lowerLimitThreshold"=>"<number>", "upperLimitThreshold"=>"<number>"}], "actions"=>{"email"=>{"active"=>"<boolean>", "address"=>"<string>"}, "notifier"=>{"active"=>"<boolean>"}, "status"=>{"active"=>"<boolean>", "severity"=>"<number>"}, "event"=>{"severity"=>"<number>", "limitInterval"=>{"active"=>"<boolean>", "value"=>"<number>"}}}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string | ||
Accept | string |
RESPONSES
status: Created
{"_embedded":{"rule":{"ruleId":"580a52f638394c8ab35f22f03556a7ed","assetType":"myiottenant.GearBox","assetIds":["9f81490428644ff995b0e3590f21ef57","76a1388fee23496bacac9bc378aa65fe"],"name":"Gear box temperature \u003e 85°C","description":"Raise warning if gear box temperature exceeds 85°C","active":true,"creator":"\u003cName of user that has initially created the rule\u003e","created":"\u003cDate and time of rule creation\u003e","evaluations":[{"property":"/data/GearBoxTemp","condition":"\u003e=","hysteresisAbsolute":{"active":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"},"value":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"},"lowerValue":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"},"upperValue":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"}},"debouncingTime":{"active":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"},"value":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"}},"threshold":50,"lowerLimitThreshold":25,"upperLimitThreshold":75},{"property":"/data/GearBoxTemp","condition":"\u003e=","hysteresisAbsolute":{"active":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"},"value":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"},"lowerValue":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"},"upperValue":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"}},"debouncingTime":{"active":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"},"value":{"value":"\u003cError: Too many levels of nesting to fake this schema\u003e"}},"threshold":50,"lowerLimitThreshold":25,"upperLimitThreshold":75}],"actions":{"email":{"active":"\u003cboolean\u003e","address":"user1@example.com;user2@example.com"},"notifier":{"active":"\u003cboolean\u003e"},"status":{"active":"\u003cboolean\u003e","severity":"\u003cnumber\u003e"},"event":{"severity":"\u003cnumber\u003e","limitInterval":{"active":"\u003cboolean\u003e","value":10}}}}},"quota":{"active":31,"total":50,"limitActive":70},"message":"Rule created"}