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
Dual Super User

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
Dual Super User

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.

Thank you sir. That worked 🙂

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,838)