Upload an image using Call REST

I want to send image to API and I am not getting option for that in mendix. So how can I upload a image directly from my desktop to server?
2 answers

If you have a POST endpoint published in your Mendix app, you can accept files as binary content.
Your endpoint needs to accept a body parameter accepting an entity with specialization of FileDocument.

In that microflow, you'll receive the file in that entity's object.

I used Postman with Request body being Binary and passed a file –


You could convert your image to Base64 and then send it to the API. On the server end, convert back to image and store it on the server.

Community commons module already has ways of converting it to Base64, you could check that one.


Hope this helps!


UPDATE – Since this is related to Mx 9, I think Kshitij's answer is more appropriate. In older versions of Mendix where you don't have this option, one could use the above solution.