I'm trying to send a json object and 2 images to an api provided by the customer.
In Postman this all works just fine, but through Outsystems I get an 500 Internal Server Error, and on the api's side they are getting :
Exception while executing function: CreatePricebookFormatByLocationCode Unexpected character encountered while parsing value: �. Path '', line 0, position 0.
The first 2 AddPart nodes are for the images :
then I serialize the input object:
and add it to another part.
The json generated here works in postman.
I tried putting "application/json" in the ContentType field but I get the same error
and then the call to the api
The api setting are as follows:
Any ideas?
It seems this issue is related to Service Studio version 11.53.43, the latest stable version at the time I'm writing.
My SS was automatically updated while I was working on this.
After reinstalling the previous version, it started working again.
I don't know if this might be due to the recent inclusion of Multipart/form-data natively in Outystems.
That is very weird. I'd open a support case with OutSystems, as it doesn't seem to be related to this component per se, and you can't stay on the old version for ever...
The Integration log trace is
POST https://URL/pricebooks/Pricebooks/formats/location/6797 HTTP/1.1
User-Agent: OutSystemsPlatform
Content-Type: multipart/form-data; boundary="------6f179a7b-2de8-4441-9e65-aedd18217f78"
Ocp-Apim-Subscription-Key: KEY
Host: HOST
Content-Length: 6279
<BINARY DATA>
HTTP/1.1 500 Internal Server Error
Request-Context: appId=cid-v1:bfc2aeac-711e-4f19-b2b5-a62720acca24
Content-Length: 0
Date: Thu, 09 Mar 2023 10:39:37 GMT
X-Powered-By: Fiberglass
Postman (this works)
I don't have any ideas right away about what could be the problem. I would advise you to make a test screen that downloads the MessageBinary output to a file, and inspect the content of the file with e.g. Notepad++. It'll be partially the binary data of the images, but maybe you can at least check if all the parts look like they should.
Btw, if you're on the latest Platform version, and the latest Service Studio, you do not need Multipart/form-data for connecting to a REST API that needs this format. See here.