Hi, 

As I am new to Outsystems. I have successfully consumed the REST API and I am getting the response. Now I am trying to consume the REST Service which is a user-initiated service i.e: If we want to get the weather of any particular location user enters the location and he gets the know the weather of the place.

I tried implementing but on the service call, I get the below error:


I have tried multiple things like changing the data type but none helped.


Thanks!

Hi,

What the error message tells you is that the response you receive is not what you have defined in OutSystems what the response structure is.

Did you try and get the response using the REST API test tab, and from there generated your OutSystems response structure?

Else you could do the REST call in a tool like SOAPUI or POSTMEN en to get the json response.

You then can generated the correct structure in OutSystems from that JSON response.

Regards,

Daniel

Hi Daniel,

I am using the below response:

Did you copy the response to the body to generate the structure for your API method?

Can you share the structure definition?

Also the error message says it receives a value False it can not converts, out your response does not have a Boolean.


Hi Shobhun,

Best thing to do to see what’s actually happening with your response is to add an OnAfterResponse action and set a breakpoint in it and debug it. Then you check the value of the ResponseText attribute in order to see what the JSON actually looks like. 

Like Daniël says, it looks like you’re missing a boolean attribute in your current Response structure.

Regards,

Nordin

Nordin Ahdi wrote:

Hi Shobhun,

Best thing to do to see what’s actually happening with your response is to add an OnAfterResponse action and set a breakpoint in it and debug it. Then you check the value of the ResponseText attribute in order to see what the JSON actually looks like. 

Like Daniël says, it looks like you’re missing a boolean attribute in your current Response structure.

Regards,

Nordin

Thank you, Nordin,

I tried debugging. The image of error message which I posted earlier is the error message which I got after debugging.

Daniël Kuhlmann wrote:

Did you copy the response to the body to generate the structure for your API method?

Can you share the structure definition?

Also the error message says it receives a value False it can not converts, out your response does not have a Boolean.


No, I didn't copy the response to the body but while consuming/testing the service it asked do u want to use the response of the service I clicked on yes and then it created the response structure by itself.


Ok could you share the structure (screenshot)

Daniel,


I am quite new to outsystems can you please guide me so that I can reach the structure and share the screenshot.

Solution

Shobhun Shah wrote:

Nordin Ahdi wrote:

Hi Shobhun,

Best thing to do to see what’s actually happening with your response is to add an OnAfterResponse action and set a breakpoint in it and debug it. Then you check the value of the ResponseText attribute in order to see what the JSON actually looks like. 

Like Daniël says, it looks like you’re missing a boolean attribute in your current Response structure.

Regards,

Nordin

Thank you, Nordin,

I tried debugging. The image of error message which I posted earlier is the error message which I got after debugging.

Hi Shobhun,

I'm not sure you understood what I meant.

Create an OnAfterReponse for your REST API.

Then set a Breakpoint inside the OnAfterResponse action and debug the REST call.

During the debugging you can check the value of the ResponseText attribute of the Response input, which holds the actual JSON, and compare it to your current Response structure.


Hope this helps!

Regards,

Nordin

Solution

Thanks, Daniel and Nordin.

Hi Shobhun,

Please remember to mark the solution to your question, as to help others find solutions to their questions easier.

Thanks,

Nordin

Hi Shobhun Shah,

Can you explain what was the problem in the end and how you solved it? I'm sure that would be quite useful for many of your fellow forum readers!

Thanks!