How can i receive Mutipart/ form-data request in policy level?

Not applicable

I want to receive multipart request in APIGEE policy level.

My request format :

"userid" :"userid@gmail.com"

"username" : "username"

"thumbnailimage":thumbnail image file

"originalimage" : original image file

In my case I wanted store userid and username to the database and store both image files different server by calling another API, that API return URL of both the images.Again need to store the image url's against userid.

How can i handle in APIGEE policy level. I can do the database operation using JAVA callout.

Please suggest me best practice.

Thanks in Advance.

Solved Solved
1 1 1,393
1 ACCEPTED SOLUTION

Unfortunately multipart form data is not easy to parse in the Apigee Edge gateway.

Normally people design their APIs to avoid those formats. For example if you design your API to accept JSON or XML, then it's easy for Apigee Edge to handle the request and parse out the parameters in the inbound payload.

If you absolutely insist on using multipart-form , then I suggest that you use your Java callout to parse out the pieces you want. You will need to convert the octet streams into ... whatever is necessary for your external blob storage.

For example, using something like the MultipartStream in Apache commons-fileupload.

This callout (Apigee-Java-Simple-MultipartForm) is a working example of how you can parse multipart forms.

View solution in original post

1 REPLY 1

Unfortunately multipart form data is not easy to parse in the Apigee Edge gateway.

Normally people design their APIs to avoid those formats. For example if you design your API to accept JSON or XML, then it's easy for Apigee Edge to handle the request and parse out the parameters in the inbound payload.

If you absolutely insist on using multipart-form , then I suggest that you use your Java callout to parse out the pieces you want. You will need to convert the octet streams into ... whatever is necessary for your external blob storage.

For example, using something like the MultipartStream in Apache commons-fileupload.

This callout (Apigee-Java-Simple-MultipartForm) is a working example of how you can parse multipart forms.