Is there a way to read/assign images from form data ? Basically will receive two images in form data & will need to read/pass thru 1st image to backend api url1 and 2nd image to backend api url2?
This might help Vinay. https://community.apigee.com/questions/39803/how-to-post-multipart-request-in-apigee.html
We don’t use node js. Is there a simpler solution to extract each image and use service callout to post ?
Any quick suggestion/sample would help.
Hi @vinay, did you explore converting the image to base64 & running trials with it?
I’m not sure if it makes sense. I will try and let you know.
@Dino any thoughts as how to proceed?
There is no builtin policy today that parses a form payload and extracts the attached files. You will need to code an extension. Your options are:
- Java callout
- Python callout
- Nodejs target
A Javascript callout might also work, but using JavaScript to handle the octet stream is more challenging. basically when you retrieve request.content in a JavaScript callout, you’re going to get a string, which… prevents you from accessing the bytes directly.
If I were doing this I would code it in nodejs.
BTW, I don’t like the idea of using multipart/form-data for an API. That is what is causing this difficulty in handling the payload. If the API were in some more API-friendly framework, like JSON or … just about anything else, then your challenge would be easier.
Is there some sample poc if you can provision which we can use via java/node.js as well.
we don’t use much with node.js but will see if it feasible but the calls should be for two diff api calls.
image1->url1
image2->url2
please assist.
sure.Looking for some options to do.