Edited: NOOB: Return from REST API should be list

0
Noob here... I’m trying to retrieve data from a REST API in a microflow that I can display on a page as a list. In my microflow, I have a “Call REST” activity, then a Create list, and end with a return of the List of objects (trying to retrieve all objects each with 2 attributes) that I’d then like to fill up the domain model object. The JSON structure is mapped.  On my page that calls the Microflow, there are no errors. The page compiles, but when I load the page, there are no items in the list. Am I missing something?   Any thoughts on where I’m going wrong? Am I returning the wrong thing to the list view? Is the sequencing incorrect? Get – List – return List?  
asked
2 answers
0

First improvement: In your domainmodel rename Items to Item. Entity names are better singular. Your ‘Call REST (GET)’ return one item only, not a list of items.

Best way to find out what the call returns is to first ‘Store result’ in a variable (string). Then restart and debug to see the content of that variable.

Do the import-mapping separately after that call, passing your variable into the import-mapping. This gives you most control during development. You will probably figure out the last steps.

answered
0

Hi Gabe, you should return the list of Items from the rest call (if it's really a list, right click and choose set as return value) or if you want to go with your current actions because it's a single object, add an extra ‘change list’ action at the end and choose ‘add’ and set the $Items to be added.

 

answered