How to extract multipart request data sent from API Gateway in flow service?

Hi Everyone,

I am trying to send a multipart/form-data request to flow service but not able to extract the data in flow service. When I create a REST resource and use my flow in it then it works fine but when I try to use my IS service in routing policy in API gateway then my payload is not getting extracted and give error for missing body parameter at pub.mime:mergeHeaderAndBody.

Any help would be appreciated.

Hello Usman,

Could you please provide some more details on the problem.

How is the multipart request invoking Flowservices. Is it receiving a http request. Also, how are you extracting the multipart data in flow service. Some more details on that would be helpful.

Regards,
Sumit

Hi Sumit,

Thankyou for your response.

I was able to fix it after trying different approaches.
This is how i extracted the payload:

-First I changed my input/out to use RequestSpecs.
-Then in case of multipart payload comes as bytes in payloadObject of RequestSpecs instead of
payload String.
-Then i parsed the bytes to stream as required to create mime data by using build in service
bytesToStream.

I would suggest you to use OpenAPI consumer support in Integration Server to consumer multipart requests. It provides seamless support for multipart data without the need of user build the mime data from payload. Mime data is automatically parsed and add to pipeline.

Regards,
Sumit