How to send attachments to a 3rd party REST service in a SetFields REST filter? |
This knowledge article may contain information that does not apply to version 21.05 or later which runs in a container environment. Please refer to Article Number 000385088 for more information about troubleshooting BMC products in containers. NOTE: File encoding can be done in binary format only. However if the 3rd party REST service requires the file in another format such as base64, a filter / run process operation can do that conversion. Reference documentation: https://docs.bmc.com/docs/ars2002/calling-third-party-rest-apis-in-a-remedy-application-909638089.html#Callingthird-partyRESTAPIsinaRemedyapplication-multi(Optional)Toaddattachmentdatainformation There are some details that is not done, the attachements nor the data will be sent: 1. The attachments have to be mapped in the Request mapping 2. The attachments also have to be mapped in MultiPart info 3. A null entity with any name should be created in multipart info 4. All data that is not a file will only be sent if it is linked to the null entity created in step3 Details: 1 The attachments have to be mapped in the Request mapping Minimal requirement: Field Name should map the attachment field Optional : if JSONKey has a valid string the name (only the name) of the attachment will be sent as a property inside object called "something" Details: 2 The attachments also have to be mapped in MultiPart info
Example of mime part
--Boundary_23_67127307_1588796349899 Content-Transfer-Encoding: binary some-fake-header: fake-value Content-Type: application/octet-stream Content-Disposition: form-data; filename="encoded_png.txt"; name="attach-Attachment2" iVBORw0... --Boundary_23_67127307_1588796349899- Details : 3. A null entity with any name should be created in multipart info
Details 4. All data that is not a file will only be sent if it is linked to the null entity created in step3
--Boundary_23_67127307_1588796349899 Content-Type: application/json Content-Disposition: form-data; name="something" {"something":{"a1":"encoded_png.txt","a2":null,"will be sent":"testasasd"}} --Boundary_23_67127307_1588796349899 |