I am working with Mule 3.8 and need to send a file to target REST service in json (base64).
I am trying to find options but any of them is not working. I have a file in my payload or else I can read it from file.
Here is my approach. Generate JSON in Dataweave transformation using script and add the file content (transform to base64). This will give us JSON in required format. However we need to add file content in JSON too (sample JSON is below). We can get the file content using #[message.inboundAttachments['file'].dataSource.content]
in payload, but not sure how to pass the same to dataweave.
> { "form_data": { "name": 'xyz' }, "files": [ { "fileid": "id1",
> "filedata": "base64 file data" }] }