Sending Composite Data through REST
  • 07 Jul 2021
  • 1 Minute to read
  • Dark
    Light

Sending Composite Data through REST

  • Dark
    Light

Article Summary

Overview

This tutorial demonstrates how to send Composite Data Types via the POST method using Rest Service Integration.


Define the Rest Service 

Use the example to create a Rest Service Integration with the POST method. Then, add a custom Rest Header to the Service Integration. Finally, create a simple Flow to test sending the Composite Data Type with the custom Rest Header and deserialize the returned Data. 
  1. Navigate to System > Integrations > External Services in the Portal, then select ADD REST SERVICE from the top Action bar.
  2. From the Add REST Service window, define the Service Name and Service URL
    1. Click SAVE INTEGRATION.  

  3. From the newly created Rest Service Folder, navigate to All > Add Method to Service

  4. In the resulting pop-up window, provide a Name, and define the URL as "test."
  5. Define the HTTP Method as POST and Service Content-Type as JSON.
  6. Select Specify Below (Use {} for variables) from the Request Body Format dropdown. The Request Body is used to define the Composite Data Type between the two curly brackets. Define the Request Body as the following code snippet, then select OK.
    JSON
    {
    "namedsession": "{sessionID}", 
    "datastring": "{stringinput}"
    }


Design the Flow

  1. Navigate to a Designer Project and CREATE a new Flow. 
  2. In the Toolbox expand INTEGRATION > REST SERVICES > [NAME OF SERVICE].
  3. Drag and drop the Test step into the workspace.
  4. Navigate to the Properties panel and expand Inputs. Notice the two variables that were defined in the Request Body of the Method.

Other Request Body Formats

  1. Navigate to the previously created Rest Service Folder, System > Integrations > External Services. Next, select the Method, choose Edit Method in the action menu.

  2. In the REST Service Method dialog, change the Request Body Format to Serialize from Data Type
  3. Under Request Body Data Type, search for and select Account.
  4. Select OK.

  5. Navigate back to the previously created Flow. 
  6. Select the Test step and open the Properties panel. Notice that the Inputs changed to the Account data type. 

Was this article helpful?