Requirement: We have a scenario where we want to send a request to a REST API that takes the request as multipart in below format:-
- JSON - in the body (this JSON has information related to the file we are attaching in the request)
- CSV text file as an attachment (doesn't have to be encoded).
Solution: This can be achieved by following the below steps:-
- In Ws Rest Consumer Activity
- Create a Ws Rest Consumer activity and define the Request Media Type as "multipart/form-data".
- Now, select the "Enable multipart" checkbox and specify Part Name and File Name as desired.
- In Process flow designer
- Create a Source File activity for CSV text file that needs to be sent as an attachment.
- Create a put-Context variable to define JSON data in the request body. The variables are:-
- multipartRequestBody
- multipartRequestBodyType.
After attaching all activities, the process flow will look as shown below:-
Comments
0 comments
Article is closed for comments.