HTTP interaction services, also known as UbiHTTP. It allows the communication between devices, websites, and Web services without implementing protocols at the device level. You can specify operations in UbiHTTP and then trigger them in other Ubibot functions, such as the alert function.
Create a UbiHTTP request
1. Create a new UbiHTTP request. Click “Data factory” -> “HTTP interaction”, and then click new UbiHTTP;
2. Specify Settings. Not all Settings are required for every type of request. All UbiHTTP requests require the following parameters.
||Enter a unique name for your UbiHTTP request.
||API key generated automatically for UbiHTTP requests.
||Enter the web site address where the data is requested or written, starting with http:// or https://.
||Select one of the following HTTP request methods to access the web site url: GET,POST,PUT,DELETE.
Additional parameters can be specified depending on the nature of your request. For example, UbiHTTP requests to servers that require authentication require a user name and password.
|HTTP authorized user name
||If your URL requires authentication, enter an authentication user name to access a private channel or website.
|HTTP authentication password
||If your URL needs authentication, enter the authentication password to access the private channel or website.
||Enter the MIME or form type of the requested content. For example, application/x-www-form-ubibot.
||If your ThingHTTP request requires a host address, enter the domain name. For example, api.ubibot.cn.
||Enter the message you want to include in the request.
If you want to include variables in the message content, the following types of substitution characters are currently supported:
%%trigger_subject%% Subject of Alert Message
Alert Reminder – The channel id XXXX (C-xxxx) is out of alert range
%%trigger_body%% Full Contents of Alert Message
Alert Reminder – The channel id XXXX (C-xxxx) is out of alert range.
Sensor:field1 (temperature)，trigger value：1 (rule name：high temperature warning).
The trigger ID is 2692595. You can log in the console to check it.
%%trigger_field%% Trigger_field Value
eg: field1 (temperature)
%%channel_id%% Channel ID
%%name%% Channel Name
%%trigger_type%% Trigger Type If it is “recover”, it will be recover.
%%sampled_at%% Data acquisition time (return timestamp)
%%rule_type%% Mode of Alert
（numeric- Sensor Alert | no_data_check- Offline Alert | status_field- USB Down Alert）
%%rule_name%% Rule Name
eg: High temperature warning
%%rule_condition%% Threshold Value of Rule
%%action_frequency%% (change_only – Once-only Alert | change_only_delayed- Delayed Once-only Alert | always- Continuous Alert | always_delayed- Delayed Continuous Alert)
%%frequency%% The delay time set when the alert is Delayed Alert ( unit:s ）
%%criteria%% Condition of Alert
%%trigger_id%% Trigger ID
%%trigger%% Trigger Value
UbiHTTP is triggered by setting up an alert rule using a GET or POST request.
1. Click “Data Warehouse” -> “Data Warehouse”;
2. Select the device to set HTTP interaction -> “Rules” -> “Create Offline/Sensor/USB Down Alert”;
3. Set the early alert information according to the application situation;
4. Mode of alert select “HTTP interaction” -> select the UbiHTTP request name just set up;
5. Save alert;
UbiHTTP requests are triggered when the device’s sensor detection value reaches a user-set threshold.
Supported Substitution Characters
If you want to include variables in the message content, the following three types of substitution characters are currently supported:
The specific display in the message will be like this:
Trigger_field Value: field1 (Temperature)
Body: The temperature now is %%trigger%% ℃.
Display: The temperature now is 27℃.
Body: The trigger field is %%trigger_field%%.
Display: The trigger field is field1 (Temperature).