Using POST Method With REST Service Integration
  • 28 Jan 2022
  • 2 Minutes to read
  • Dark
    Light

Using POST Method With REST Service Integration

  • Dark
    Light

Article Summary

Overview

A POST method is used to send data to a server via API. It also creates subordinate resources, such as a file in a directory. REST Services act as a folder that can hold any number of REST methods. 

For more information about REST Services, see REST Service Integration Overview.


Max String Content Length 
The default value MaxStringContentLength in the Settings.xml is configured by default to 1048576 (1 MB). If data is being posted over this size to Decisions or Post calls are failing to Decisions, then this could be the issue. To increase the length, navigate to C:\Program Files\Decisions\Decisions Services Manager and open the Settings.xml file. Edit the settings in all seven places within this file to a maximum of 214748364. DocuSign sends Webhooks to Decisions, the document that has been signed and is contained inside the Webhooks, can be large depending on the original PDF.

Example

In this example, a REST Service will be created with the POST method that sends new account data to a server.  For confirmation, a Flow will then be created to send a JSON object with a custom Request Body

  1. In a Designer Project, click CREATE DATATYPES/INTEGRATION. Select External Services and click Add REST Service. 

    It is possible to create a REST integration via Add REST Service Integration within the Integrations Folder. It is advised to create the integration within a Designer Folder instead. This allows the user more mobility with the project, should they have to export/import the integration to another instance, and ease access purposes. 
  2. In the Add REST Service window, define the Service Name and enter "https://postman-echo.com/" for the Service URL. Click SAVE INTEGRATION.
    When defining the Service URL, make sure the Ping Result is 200 to indicate a successful connection to the Service URL.

  3. From within the Rest Service folder, click All and select Add Method to Service.
     
  4. In the New REST Service Method, enter a Name for the method and enter "post" in the URL (Relative to Base) field. Click the dropdown list for HTTP Method and select POST.  Select JSON for the Content-Type field and Specify Below (Use {} for variables) for the Request Body Format field.
  5. Copy and paste the following code into the Request Body field. This code will create inputs within the REST service for a user to submit account information.
    {
    "accountID": {AccountID},
    "dob": {DateOfBirth}
    }
    
  6. Click OK to save and close.
  7. In the Designer Project, click CREATE FLOW and select Flow. Name the Flow and click CREATE.
  8. Click the Done path of the Start step. Navigate to Integrations > All Integrations > REST Services > [REST SERVICE] and select the POST method step. Click ADD.
  9. From the Properties panel for the REST service, set Constant values for the Account ID and Date of Birth fields. Connect the Done and Error paths to the End step. Click Save to save changes to the Flow.

Debugging

  1. Select Debug from the top panel of the Flow Designer. Click START DEBUGGING.  
  2. To view the REST service results, select the REST Service step, select Execution 1, and select View Input/Output Data. 
    If the Flow runs successfully, it will return the expected data return, a Status Code of 200, and the data of the Headers from the POST call.


Was this article helpful?