Hi Nrusingha,
A multipart form that you're posting would come with a multi-part content-type that would specify a boundary, and then the actual payload would look something like
--boundary
Content-Disposition header of the root part
Content-Type header of the root part
perhaps other headers for the root part
data
--boundary
Content-Disposition header of the attachment part, which could include a filename="your pdf file name"
Content-Type header of the attachment part
perhaps other headers for the attachment part
perhaps other headers of the attachment
data
--boundary--
What exactly are you attempting to do? If you want to simply forward the multipart form to the backend, you must ensure that there is not a parse policy that precedes the invoke policy. Are you wanting to extract the actual pdf attachment and post just that? If so, your URI of the invoke's target-url having /$(request.body.pdfFile)
does not look right. Are you expecting that to be the filename? If so then you'll need to be extracting the filename from the Content-Disposition header of the attachment and using that in your target-url.
Please provide some more detail on exactly what your requirement is.
Best Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Tue February 14, 2023 11:23 PM
From: Nrusingha Sahoo
Subject: How to upload a pdf file in IBM API Connect v10 using rest API
Hi
We are unable to upload a file in API Connect using restAPI.
We are using the below for the yaml file.
Method = Put
Protocol = HTTP / HTTPS
Body - Multi-Part
Type - File
In invoke we have given the target path as https://<host>:<port>/nlpmDev/Transport/$(request.body.pdfFile)
Please help or suggest on this.
Thanks
------------------------------
Nrusingha Sahoo
------------------------------