Rest Handling for ServicesLast Updated: 07/19/2016 Introduced in Verision: 2.0 |
Summary
A flow can be made into a REST web service that supports either HTTP GET or POST methods. REST calls to a flow require either (1) valid user session ID, or (2) valid user authentication ID. The REST Service API shows instructions for calling the flow, as well as the output. The Actions menu for the flow provides REST service call URLs that are already populated with the necessary parameters.
Example
In this example we are going to use POST method to pass data into the flow using REST service call.
We begin in the Designer Folder by clicking Create Flow to create a new flow.
Next, we name the flow and click Create to proceed to the Flow Designer.
We need to create variables or data structures for our flow input to hold data that will be Posted to the flow.
In the Flow Designer select start step on the workspace. In the right panel we locate Flow Input Data box and click Add New link to add new input data to our flow.
We name our first input FirstName and select String type for it. Click Ok when finished to return back to the Flow Designer.
In the same way we add second input and name it LastName. So our flow expecting two strings to be passed in.
Next, in the Flow Settings we check Create Service checkbox to create a new service for our flow.
On the workspace we connect flow’s start step to the end step. We select the end step to configure the output.
Under the Output options we click Add New link to add new output data structure.
We name our Output and select String for its type. We click Ok when finished to save and close this pop-up window.
Back in the Flow Designer with end step selected we can see alert message that tells us that we need to provide our Output with Mapping Type and Value. From the Mapping Type dropdown menu we select Text Merge.Plain.
Next, we click Show Editor for Merged Text option.
We configure our Merged Text as follow. Click Ok when finished to save and close Editor for Merged Text.
This completes our flow. We can save and close it.
Back in the Designer Folder we locate the Thumbnail for our flow. On the thumbnail we click Action >
Run [Advanced] > Integration > View Integration Details.
Note:
Integration Details for Services that we have created previously in this example for our flow opens.
We are going to use Named Session for the Credentials. In the Display Settings we leave REST option and click Show Service Api button to view settings that are needed to make a successful call to the service.
Settings are being displayed on the same page. We are going to use POST method so we look at Call via POST section. We are going to need the URL and also we need to pass the parameters provided in this section. Mention that there is a XML Serialized Representation of Inputs. Our flow will accept the parameters only in this structured way or we will get a service error. Also we can see the Expected Output which is as well in XML. In this example we are expecting outcome named Done with a variable named Output, and this variable will hold our string that we built in Merge Text Editor.
Next, we are going to test our call… Mention that we are passing desirable values in the parameters. Our flow will use those values after they are posted into flow.
And we are getting successful Response from the service with the desirable output…