A flow, which can receive numbers from an HTTP request body and do some arithmetic operations with them.
Let's start with the HTTP Listener. This Listener accepts requests from outside (internet) to access the workflow. This component has a small feature: there is no input and no output. If you are wondering why this component does not need to be connected to the workflow: an HTTP Listener can be used by several components.
In this case, the component is configured to open listening port 10,002. The Listening Port can be freely selected within a certain numerical range – you will find a selection in the settings of the component (double click on the component). If we are already in the settings: to offer encryption on the port, the checkbox Secure (SSL) and the default certificate can be selected. For special applications, a separate SSL certificate can also be used.
Next we look at the HTTP Route components. Each HTTP Route listens for "POST-requests" on the displayed URLs from the HTTP Listener. When a request is received, the HTTP Route sends it to the next component: to the respective Code component.
The existing code components perform the following tasks:
- test echo: outputs the transmitted text unchanged
- test echo jsonvalue: outputs the transmitted JSON object unchanged
multiplyrandom: multiplies the transmitted number by another random number
multiply99: multiplies the transmitted number by the number 99
checkodd: returns true or false, depending on whether the transmitted number is odd or even
In this workflow we have quickly arrived at the last component: the HTTP Response component is the response to the HTTP Request component and ensures that the data generated / calculated by the code component is returned to the client.
Finally, we take a look at the debug component. Currently this is not active or connected to the workflow. For testing purposes, you can connect it to the code components. After clicking Apply, the flow and HTTP Listener are running
If you want to test the proper functionality, please use the curl commands below. If the code component is connected to the debug component, you will see the request body in the sidebar at the right Here is one small thing we have to pay attention to❗. Note that you have to enter your own instance ID: $instance_id → change to own ID.
That´s it – have fun testing! 😊
We get back to you as soon as possible.