For each from an array in the previous response
Hi,
Just been off of XANO (Was in XANOAX mode π) for a couple of months, and oh boy forgot a lot of stuff, feeling rusty.
Hope you can help me:
I am running an API request and I get an array "results". I now need to run a For each loop to each id inside the results. but when I try to get the path I get the 1 value in the array:
api_2.response.result.results.0.protocol_id
api_2.response.result.results.1.protocol_id
How can I set the path, so that it will go through the whole array and not a certain index position of the id?
Thank you very much in advance.
Best Answer
-
Ok I solved it, was simpler than as I remembered, Just grab the "item" in the Loop and then in the body of the loop I used "item.protocol_id".
It worked as expected π. Thanks anyway @Lefteris - blupry.com π.
Answers
-
Hey @JJ ,
Welcome back!
If I understood correctly, all you need to do is iterate through the list "api_2.response.result.results" and each time save the item.protocol_id (maybe by pushing it into an array created outside the loop) -
Happy to be back, thanks π.
Each time I will go iterate through the list correct, but I will use that id of the list to make another API request based on the ID.
Example:
I run an "Accounts" API request, it gives me as a result, an array list of account details which "protocol_id" is the primary key for each account.
Then I need to use a For each loop, to iterate through each "protocol_id", in order to get all "Contacts" from each account.
I am going through the videos again, but didn't find a solution yet "out of the box". Thank you very much.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?β? Find an Expert
- 348 βOther questions
- 35 ? Security
- 22 βοΈ Snippets
- 19 ? Showcase
- 7 ?οΈ ο»Ώ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback