How to send Outbound REST request with multipart/form-data



This article describes the procedure to send an outbound REST request of type 'multipart/form-data'.


Multipart/form-data requests are supported only via REST action step in the IntegrationHub which comes as part of the ServiceNow IntegrationHub Installer plugin available for a fee in the Madrid release. 


Once the required plugin is activated, follow the below steps to create the flow.

  1. Navigate to "Flow Designer" in the filter navigator. 
  2. Click on "Designer"
  3. Create a new flow by clicking on "New" and selecting "New Flow"
  4. Enter the Name, Application, Description, Run as user and click on Submit. 
  5. Set the trigger conditions as per your requirement. 
  6. Click on Save.

Below steps explain how to create the Action. 

  1. In the flow designer UI, click on the "+" icon. 
  2. Click on "New Action". 
  3. Enter the required configuration parameters and click on "Submit".
  4. Create a new step here by clicking on the '+' icon under "Action Outline".
  5. In the list of action step options, select "REST" under "Integrations".
  6. Configure the connection details by defining connection inline or by using a connection alias. 
  7. Under Request details, specify the HTTP Method as POST. 
  8. DO NOT set the Content-Type header. The request will break if you set this. The Content-type is automatically set by the REST Step. 
  9. Under Request Content, select the Request type as "Multipart".
  10. Specify the content of a multiple part request. For each request part, specify its name, content type, and value. The name can be any valid string and the type can be any valid type. The value must match the content type.
  11. For type, specify the MIME type of the content. For example, application/json, text/plain, etc.
  12. For attachments, set the type and value as given below:
    1. Type: attachment
    2. Value: The Sys ID of the Attachment record containing the content. You can look up this record in a prior step or define it as an input variable.

This completes the set up required for sending outbound REST requests with type multipart/form-data.

Please Note:

When you send the requests though a MID Server, you will need to ensure that the user configured for the MID server has read access to the attachment table. Otherwise both the outbound HTTP log and the ECC queue input will indicate that the particular attachment could not be found.