I am same issue while consuming 3rd party REST API
Kindly find the below response from the api
{ "messages": { "result": "Ok", "message": [ { "code": "P001", "text": "Successful." } ] }}
It is perfectly fine with the "Postaman"and "Fidler" i did the test only having issue with outsystems.I am getting the below error
This is my structure
Please share your thoughts on it, so that i can resolve it
Having same error message in the service center. Where I set logging level to full
Hello Pradip,
It is usually this error happens when the answer is not a valid JSON .This can happen for many number of reasons, so it's possible to happen even if most of the time the server still returns a valid response.
Please check your response and mapping to the structure you have created specially all the data types of the response and structure should match.
You can also look into this Discussion.
Regards
Neha
Hi Pradip,
I guess there could be issue with name in json parameter
Check what you have configured in message structure and message item structure. Also check the data type of each attribute.
As I wrote in the other topic:
"This looks like a REST service that returns a UTF BOM (byte order mark) at the start of the message. I've encountered this once, and had to strip it from the message in an On After Response."
to which you answered:
"Can you please help me how can i do it? I have more than one request & for every request something differente/ dynamic is coming. For 3 diff. request have 3 diff. o/p with some extra charactes or special characters.Is there any std way to normalize it. Even if i created structure using json it is not supporting because in the normal string that extra space or character is not visible."
The OnAfterResponse works for all methods of an API (that's somewhat unfortunate, but in this case useful). The BOM is always the first three bytes of a payload (in UTF-8 encoding), and has the hexadecimal values of EF BB BF. So you can check in the OnAfterResponse whether the first three characters contain those values, and if so strip them. Check them like this:
Substr(CustomizedResponse.ResponseText, 0, 3) = Chr(239) + Chr(187) + Chr(191)
(again, assuming you receive utf-8). If that matches, strip them like this (assign this to the ResponseText):
Substr(CustomizedResponse.ResponseText, 3, Length(CustomizedResponse.ResponseText))
That should suffice.
I once created an Idea for OS to handle this automatically, but unfortunately it was rejected.