Display the results of a REST call

Display the results of a REST call

  

I made a REST call in a button's Action.  But I can't seem to find out how to display the results.

When I setup the REST call, it made a bunch of structures that related the the results of the rest call.  

But I cannot find a way to get to that data!

If I hover over the call it shows that it has an output of "PatientCards".  But if I try to use that value in an expression, it gives red squiggles.  I tried several other ways to address it (using the call name first etc), but I cannot find anyway to get to the response.

I will confess that I am frustrated.  It just seems like it should be easier.  

And there are at least 10 different pages about how to setup a REST call in the OutSystems docs, but they all stop at how to set it up in the Logic tab.

How do I get at the results of the call?  Use the structures?  Display the data that was retrieved from my REST service (which was not made in OutSystems, in case it matters).

Solution

OK, I figured this one out!

You need to make a variable in the Screen, then in the action, assign the result of the call to the newly created variable.  

I think this is one of those things that everyone but me knew because I am new to OutSystems and decided to start with a service call.

Solution

Hi,


It depends a lot on the format of your data.

On this page there is an image at the end displaying a list from a REST, the main difference is that the action is being called in the Preparation.

Since you are calling it on a button action, you will need to do a bit more to get it in the screen widgets "scope".
In general you would need to create a local variable on your screen with the same type of the returned data, and use that variable on the screen widgets.
Then on your button action, assign the variable after the REST call and then do an Ajax refresh of the part of the screen that you need to refresh. Check this video if you need some help about the Ajax refresh.



Edit: hehe my reply was a bit too late.
Nice that you got it figured out. :) 


Regards,
João Rosado