cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vstar19
Helper V
Helper V

Loop through an array variable using API

Hi,

I have an array variable which stores items numbers, as below (I have called the array variable My Array)

[
  "Item1",
  "Item2",
  "Item3",
  "Item4"
]
I would like to call each item through an API.
 
I have inserted an Apply to Each Step and added in the HTTP Request, as below
 

my-array.png

 

 

 

 

 

 

 

However, when the flow runs, the HTTPs returns requests as

https//myapi.com/api?.itemsNumbers=[Item1,Item2,Item3,Item4]

 

I need the output to return results as

https://myapi.com/api?ItemNumber=Item1

https://myapi.com/api?ItemNumber=Item2

https://myapi.com/api?ItemNumber=Item3

https://myapi.com/api?ItemNumber=Item4

 

So I can pull data about each item.

Can someone please assist me.

Thanks

 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

The Apply to each loop is working on the whole array.  So instead of inserting MyArray into the HTTP call you want to use the entry in dynamic content called 'Current Item'.  That will be the one that contains the array element.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Pstork1
Dual Super User III
Dual Super User III

The Apply to each loop is working on the whole array.  So instead of inserting MyArray into the HTTP call you want to use the entry in dynamic content called 'Current Item'.  That will be the one that contains the array element.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Thank you sir. That worked 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,540)