Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 83469

Base64 encoded string in JSON

$
0
0
IMHO the documentation on using filedocuments in REST services could be improved to say it mildly. I am trying to transport one filedocument with metadata fields through REST services between two Mendix environments. My first option was to base64 encode the file. I have created an export mapping. The JSON that comes out of it works when I put it in postman and send it over. I had some problems because when I base64 encode the file it contains characters that are not allowed in JSON so I had to URLencode the base64 string. The other side can decode it first before doing the base64 decode so that hurdle is taken. But when I am trying to post that JSON the Mendix server console gives me the error below. What am I missing here? Before the POST action I do the exact same export mapping and the resulting JSON is correctly handed by the other side. Or should I create the base64 string in a different manner? Response content for POST request to http://somerestservice HTTP/1.1 400 Bad Request Date: Mon, 15 Jun 2020 10:31:07 GMT Cache-Control: no-store Content-Type: application/json;charset=utf-8 Content-Length: 67 {"error":{"code":400,"message":"Unsupported Content-Type header."}} I also tried exposing the object that inherits from filedocument. So on the receiving end all is created by Mendix. But the body parameter that is received is missing all the metadata information. So I am either doing something wrong on the sending side with the content type or something else goes wrong. Unfortunately good examples are missing on ( https://docs.mendix.com/refguide/call-rest-action ) the documentation here on how to use custom requests with mixed content containing binary. Regards, Ronald  

Viewing all articles
Browse latest Browse all 83469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>