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.
- Navigate to "Flow Designer" in the filter navigator.
- Click on "Designer"
- Create a new flow by clicking on "New" and selecting "New Flow"
- Enter the Name, Application, Description, Run as user and click on Submit.
- Set the trigger conditions as per your requirement.
- Click on Save.
Below steps explain how to create the Action.
- In the flow designer UI, click on the "+" icon.
- Click on "New Action".
- Enter the required configuration parameters and click on "Submit".
- Create a new step here by clicking on the '+' icon under "Action Outline".
- In the list of action step options, select "REST" under "Integrations".
- Configure the connection details by defining connection inline or by using a connection alias.
- Under Request details, specify the HTTP Method as POST.
- 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.
- Under Request Content, select the Request type as "Multipart".
- 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.
- For type, specify the MIME type of the content. For example, application/json, text/plain, etc.
- For attachments, set the type and value as given below:
- Type: attachment
- 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.
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.