Create rule

This API creates a rule for the user. Devices specified in the rule must exist. The caller must own, or have rights to, the device. Actions can be included at rule-creation time, or they can be added to the rule later.


Parameter nameDescription
nameRule name
descriptionBrief information about the rule
expressionExpression of a logical statement about relationship between the entities.Expressions always evaluate to true or false. If they evaluate to true, the rule performs the associated action(s).
Example 1: str_equals(DATAPOINT(AC000W000000001,cmd),'on')
Example 2: VIRTUAL(uuid_2) && ((DATAPOINT(dsn_1,prop_name_1) - DATAPOINT(dsn_2, prop_name_2) > DATAPOINT(dsn_3,prop_name_3) + DATAPOINT(dsn_4,prop_name_4) ) && (distance_miles(LOCATION(uuid_1),LOCATION(dsn_1))) < 112)
Example 3: DATAPOINT( ${oem_model == podth1})
actions_idsList of action IDs associated with the rule. (optional)
is_templateIndicates if the rule is a template. Mandatory if the rule is a template. If true, expression must be abstract, i.e. defined on a group of devices. (optional)
is_subscriptionThis parameter is mandatory if the rule is of type "SUBSCRIPTION". actions_ids associated should also be of type SUBSCRIPTION.
user_uuidThis is used by API caller to create action on behalf of the user who has the {user uuid} registered with the OEM. Only OEM::Admin roles can use this parameter.

Request example for DATAPOINT :

	"rule": {
		"rule_uuid": "1876543a-3456-23a9-301e-402bef3e22e3",
		"name": "Rule1",
		"is_enabled": true,
		"description": "Description",
		"expression": "DATAPOINT(dsn1,prop1) < 60",
		"action_ids": [
		"created_at": "2022-10-01 09:42:50Z",
		"updated_at": "2022-10-01 09:42:50Z"

Request example for "is_subscription = true":

	"rule": {
		"action_ids": [
		"description": "Rule Description",
		"expression": "DATAPOINT(TESTDSN_ARE7422007_1405,integer_input_tp)==10",
		"is_subscription": "true",
		"name": "TestRule-7422007-408843"

Response example for "is_subscription = true":

Click Try It! to start a request and see the response here!