Function description

The flow uses the Httpin node (Siemens) and listens for a URL end point /hello. An arriving http POST Request is sent back as a response with the message"Hello, xxx".

NOTICE
Data communication no longer operating

Program data can no longer be exchanged between the rule engine and Climatix IC.

  1. Never import the original node from Node-RED.
  1. Use only Httpin node from Siemens.

Original Node-RED

Siemens

 

Flow

Configuration

Node configuration

 

Node

Node details

Description

1

Httpin

Function block Inject initiates the start of the flow based on a keyword, for example, Hello.

The following data can be entered or selected:

Name = Function name.

Method = Select POST in the drop-down list.

Endpoint = Enter the keyword to start the function.

URL = https://<Link to system> /httpin/hello

Auth. Token = Select Generate auth. token and copy the generated auth. token to the clipboard (see Authorization token by table).

2

Template

Function block Template defines the output format.

The following data can be entered or selected:

Name = Function name.

Property = msg.payload

Template = Hello, {{payload}}!

Format = Select Mustache template in the drop-down list.

Output as = Select Plain text in the drop-down list.

3

http response

 

Function block http response replies with the value.

The following data can be entered or selected:

Name = Function name.

Status code = Enter 200.

Headers = Enter Content-Type. Enter Plain/text;charset=utf8.

 

 

Authorization token

The auth. token must be entered on each webhook that communicates with the rule engine. The generated auth. token can use multiple webhooks on various projects. This permits the reuse of libraries.

Syntax:

AdditionalHeaders=“Authorization: < Key >“

NOTICE
Unauthorized use of data

Data can be altered or completely suppressed. Information or alarms can no longer be forwarded from or to Climatix IC.

  1. Never provide access to the Auth. token to third parties.

Example code for copy

[{"id":"a4df3144.5fbd6","type":"tab","label":"httpIn node sample flow","disabled":false,"info":""},{"id":"684d41a8.98c92","type":"httpin","z":"a4df3144.5fbd6","name":"POST name","url":"hello","method":"post","swaggerDoc":"","x":110,"y":160,"wires":[["4f660fd9.aa965","f9722d47.0eda"]]},{"id":"4f660fd9.aa965","type":"debug","z":"a4df3144.5fbd6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":275,"y":120,"wires":[],"l":false},{"id":"9f8569b9.f91368","type":"http response","z":"a4df3144.5fbd6","name":"Send hello","statusCode":"200","headers":{"Content-Type":"plain/text; charset=utf-8"},"x":570,"y":160,"wires":[]},{"id":"f9722d47.0eda","type":"template","z":"a4df3144.5fbd6","name":"Construct response","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Hello, {{payload}}!","output":"str","x":350,"y":160,"wires":[["9f8569b9.f91368"]]},{"id":"a949a077.dbc7c","type":"comment","z":"a4df3144.5fbd6","name":"Sample flow demonstrating the \"http in\" node","info":"This sample flow shows how to create a flow using the `http in` node.\n\n1. Regenerate the API Key in the `http in` node\n2. Deploy\n3. Call the flow by executing the following cURL statement in a shell:\n ```sh\n curl -L -X POST 'https://rule-engine.alarm.horizonint.cloud/organizations/<your_org_id>/httpin/hello' --header 'Authorization: <your_api_key>' --header 'Content-Type: plain/text; charset=utf-8' --data 'World'\n ```\n \n > On Windows you can use PowerShell and [`Invoke-WebRequest`](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.1) instead.\n4. The response will be _Hello, World!_\n","x":210,"y":60,"wires":[]}]