Calling a Flow as a REST Service
  • 13 Oct 2021
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Calling a Flow as a REST Service

  • Dark
    Light

Overview

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 a  valid user session ID, or 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

Creating the Flow

In this example, use the POST method to pass data into the Flow using the REST service call.

  1. Begin in the Designer Folder by clicking CREATE FLOW to create a new Flow.
  2. Next, Name the Flow and click CREATE to proceed to the Flow Designer.
  3. Create variables or Data Structures for the Flow input to hold data that will be Posted to the Flow.
  4. In the Flow Designer, select the Start Step on the workspace. 
  5. In the Properties panel, locate the Flow Input Data box and click the Add New link to add new Input Data to the Flow.

  6. Name the first Input FirstName and select String as its Type
  7. Add a second Input and name it LastName. This will allow the Flow to pass in two String Inputs.

  8. In the workspace, connect the Flow's Start Step to the End Step
  9. Select the End Step to configure the Output.
  10. Under the Output options, Click the Show Editor link to add a new Output Data Structure.
  11. Name the Output and select String for its Type. 
  12. From the Mapping Type drop down menu, select Merge Plain Text.

  13. Next, click Show Editor to configure the Output.

  14. Configure the Merged Text
  15. Click SAVE when finished to save and close the Editor for Merged Text.

  16. This completes the Flow. Save and Close it.

    Integration

  17. Back in the Designer Folder locate the Thumbnail for the Flow. 
  18. On the thumbnail, click Action > Run [Advanced] > Integration > View Integration Details.

    If a user calls a Flow that may go \Async (assigning a task to someone or running a Fire and Forget Flow) this result will be a Flow tracking id instead of the expected result.

    If a user calls the Flow as a SOAP service, they will ALWAYS receive a Flow tracking id which is different behavior than REST.

  19. This opens the View Integration Details page. From this page, select Named Session for the Credentials
  20. Then, click the Show Service API button to view settings that are needed to make a successful call to the service.

  21. Use POST method to look at the Call via POST section. 
  22. Users will require the URL and also need to pass the parameters provided in this section to set up and execute a POST call. 
  23. Set the Rest Data type to XML to allow for XML Serialized Input and set the Expected Output as XML as well. 
  24. This Flow will accept the parameters only in this structured way or will return a service error. 
  25. In this example, users are expecting an outcome named Done with a variable named Output; this variable will hold the String that was built in the Merge Text Editor.
    Note:
    Reference the table below for further information on Authentication Credentials. 

    Authentication Credentials:

    UserId/PWUsername and Password Credentials 
    GuestA special Guest Account that can be enabled and access to Folders can be granted to this user, 
    LoginThis will present a Login Screen to the user and not recommended for API. 
    SessionId/Named SessionsThe most recommended approach for API calls; see Creating a Named Session.

  26. Next, test the call. Mention passing desirable values in the parameters. This Flow will use those values after they are posted into Flow.
  27. This screenshot demonstrates a successful Response from the service with the desirable output.


Was this article helpful?