From: Rule Machine | Hubitat Documentation
Using Rule Machine from HTTP requests
It is also possible to cause Rule Machine to perform these same actions from an HTTP request. To accomplish this, you would create a trigger event with either "Local End Point" or "Cloud End Point." The endpoint URL given by Rule Machine has a form similar to the following:
http://192.168.0.36/apps/api/10249/trigger?access_token=ecd95469-bbcd-4889-a694-9b05ef80f4db
To run rule actions the above URL must be modified to include the list of rules and the action. The modification takes the following form:
/action=rule1&rule2&rule3
where action
is the action from the list above and rule1&rule2&rule3
are the app IDs of the rules to run, separated by ampersands.
This parameter is inserted in the endpoint URL just before the ?
that precedes the access_token
as follows.
http://192.168.0.36/apps/api/10249/trigger/stopRuleAct=943&956&10217?access_token=ecd95469-bbcd-4889-a694-9b05ef80f4db
This example would do the same thing as the code example above, where 943&956&10217
are the app IDs that were selected by consequence of the input for theseRules
, and stopRuleAct
is the action to perform.
The app IDs are the values selected by the input described above, for example, theseRules
. The app IDs can also be found for a rule by opening the rule and observing its appId in its URL as follows.
http://192.168.0.36/installedapp/configure/10249/mainPage
The app ID for that rule would be 10249.
Optionally, the value of the rule's built in %value%
variable (normally set to the value of a trigger eevent) can be specified by providing a string instead of an action name, as with myValue
in this example (note that this value must be URL-encoded and not conflict with the name of an action):
http://192.168.0.36/apps/api/10249/trigger/myValue?access_token=ecd95469-bbcd-4889-a694-9b05ef80f4db
Both HTTP GET and HTTP POST to the above endpoints are supported, with the same outcome for either.