on 01-23-2019 7:46 AM
Hi Expterts,
I am working on scenario where we are sending Image file to another system using Rest API. I have used below code.
//Read image content from BO and convert data binary data to string
var image : BinaryObject.content;
//Read image content
image = this.Attachment.Document.GetFirst().FileContent.BinaryObject.content;
if (!image.IsInitial())
{
Body = Binary.ToBase64String(image);
//Assign Body to files parameter
var content = "{\"files\":\"" +Body+"\"}";
var ws_result = WebServiceUtilities.ExecuteRESTService(ScenarioName, ServiceName, "POST", HttpResource,
URLParameter, HeaderParameter, "multipart/form-data" , content);
}}
I am getting below error below error message post call,
Content = {
"_id": "e67a9288-f193-4107-98d7-8a20267204fa",
"error": "Invalid request",
"error_description": "This service requires at least 1 file. Please put your file(s) into the `files` field of the POST request",
Please help me to resolve the issue. Thanks in Advance.
Hi Vinay,
at the moment you are just sending Binary.content via the rest call.
Could you try:
var image : BinaryObject;
image = this.Attachment.Document.GetFirst().FileContent.BinaryObject;
In this way you are sending the complete binary object.
Please let me know if it worked I'm no expert in this area as well.
Kind Regards,
Johannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.