Interaction HTTP 2022-07-26

Overview

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.
Required parametersDescription
NameEnter a unique name for your UbiHTTP request.
API KeyAPI key generated automatically for UbiHTTP requests.
UrlEnter the web site address where the data is requested or written, starting with http:// or https://.
MethodSelect 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.

Optional parametersDescription
HTTP authorized user nameIf your URL requires authentication, enter an authentication user name to access a private channel or website.
HTTP authentication passwordIf your URL needs authentication, enter the authentication password to access the private channel or website.
Content typeEnter the MIME or form type of the requested content. For example, application/x-www-form-ubibot.
HostIf your ThingHTTP request requires a host address, enter the domain name. For example, api.ubibot.cn.
ContentEnter 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 Messageeg:Alert Reminder – The channel id XXXX (C-xxxx) is out of alert range%%trigger_body%%  Full Contents of Alert Messageeg: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  Valueeg: field1 (temperature)%%channel_id%%  Channel ID%%name%%  Channel Name%%trigger_type%% Trigger Type%%sampled_at%%  Data acquisition time (return timestamp)eg: 1603263103%%rule_type%% Mode of Alert(numeric- Sensor Alert | no_data_check- Offline Alert | status_field- USB Down Alert)eg: numeric%%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 )eg: 120%%criteria%% Condition of Alerteg: >%%trigger_id%%  Trigger IDeg: 2692622%%trigger%% Trigger Valueeg: 1

Trigger UbiHTTP

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

For example,

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).