Invoking REST Services Example Flow Chart
This example illustrates how to invoke a REST service on a remote system using Flux. The Rest Action has only one required property: baseURL, which specifies the location of the HTTP service to invoke. Arguments can be passed to the REST service and the REST service can also return values that can be used in the flow chart.
The above screenshot illustrates a Rest Action which invokes a website that returns your IP address, http://ip.jsontest.com/.
The result returned from the REST service is of type RestAction.RestActionResult. The Rest Action postscript maps result.result to a flow context variable “ipaddress”.
Variable substitution is used in the Console Action to display the value of the quote flow context variable.
Running this Example
Getting Started
To get started, start your engine using the start-engine script and start your Operations Console by running the start-opsconsole script.
Once you have the Flux Operations console running, open the example ffc file, which can be downloaded here: GetIPAddress.ffc
To open this example, browse to the “Repository” tab of the Flux Operations Console and click the “Import” button, then open GetIPAddress.ffc from the file viewer that opens.
Running the Example Flow Chart
Next, export your flow chart to the engine. You can do this by hovering your mouse over the “Workflow” tab near the top left of the screen clicking on the “Submit/Execute” button. You can also start it using the keyboard shortcut, Ctrl+E.
A confirmation window will appear if the job was successfully exported. If there is an error message, contact support@flux.ly for assistance.
The example will display output on the Flux engine console, similar to the screen shown below.
Once this example is completed, you can shutdown your server by running the “shutdown-engine” batch or shell file within your Flux installation directory, depending upon which platform you are running Flux on.
Summary
The Rest Action is especially useful when integrating Flux with systems that are not Java-based. You can use Flux to communicate with these systems easily using the Rest Action.