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
- Create a new UbiHTTP request. Click “Data factory” -> “HTTP interaction”, and then click new UbiHTTP;
- Specify Settings. Not all Settings are required for every type of request. All UbiHTTP requests require the following parameters.
|Name||Enter a unique name for your UbiHTTP request.|
|API Key||API key generated automatically for UbiHTTP requests.|
|Url||Enter the web site address where the data is requested or written, starting with http:// or https://.|
|Method||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.|
|Content type||Enter the MIME or form type of the requested content. For example, application/x-www-form-ubibot.|
|Host||If your ThingHTTP request requires a host address, enter the domain name. For example, api.ubibot.cn.|
|Content||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
%%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
%%rule_condition%% Threshold Value of the 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.
- Click “Data Warehouse” -> “Data Warehouse”;
- Select the device to set HTTP interaction -> “Rules” -> “Create Offline/Sensor/USB Down Alert”;
- Set the early alert information according to the application situation;
- Mode of alert select “HTTP interaction” -> select the UbiHTTP request name just set up;
- Save alert;
UbiHTTP requests are triggered when the device’s sensor detection value reaches a user-set threshold.
Supported Substitution Characters
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).