Retrieving and list of objects from a REST API with a Microflow
Hi, I’m consuming a REST API which returns a list of JSON object. I’ve created the JSON structure (using the JSON returned by the consumed API) and the correspondent Import Mapping, which is basically a ROOT entity connected to JSONObjects via a 1-N JSONObject_Root association. Then in my Microflow I call the API via an Action activity “Call REST (GET)” and set in the Response tab from its properties the correspondent Import Mapping, indicating a variable (e.g. ReturnedObjects) as a result. It´s working fine. But now I´m lost: after the call, my understanding is I need to populate a list of JSONObjects with the objects returned by the Action activity and stored in the output variable ReturnedObjects, using an Action activity Change List. However, I can´t make it. Is my approach valid? How can I make it? How can I return a list of objects after consuming a REST API? Tks
Leonardo Reis Muradas
after calling the API you apply the import mapping. This results in an object of type “root”. This root object is not the list of objects you are looking for. But this list is associated with root. You can do a retrieve over association and get the JSONObjectList via this retrieve. You can do this in your microflow and return this retrieved list.
If I did not missunderstand your question, this should do it.