Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
MarlonPereira
Regular Visitor

Iterate through table to make API calls with multiple parameters

Hello!

 

I have the following table T, containing pairs of keys/secrets to access an API:

 

KeySecret
abcd11234a
fgh25678b

 

Next, I have a parametrized function F to call an API method: 

 

 

 

= (page, key, secret) =>
 
   let body = "{
                   ""call"":""ListarClientes"",
                   ""app_key"":"&key&",
                   ""app_secret"":"&secret&",
 ...

 

 

 

 

Finally, I have a simple function I to iterate through multiple pages:

 

 

 

 

= List.Generate(()=>
[Result = try F(1, key, secret)otherwise null, Page = 1],
each [Result]<>null,
each [Result = try F([Page]+1, key, secret)otherwise null, Page = [Page]+1],
each [Result])

 

 

 

What I need: for each row of table T, run I, and store all the results into one table R- after this step, I already figured out how to transform the results.

 

I tried something like this

 

 

 

let
keys = A[key],
Cli = List.Transform(keys, each I)
in Cli

 

 

 

 But since I have more than one parameter (in this case, [key] and [secret]), it didn't work. Any sugestions?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Hello, sorry for the delayed response, sudden shift in projects 😕

 

Your answer was on the right path. What I needed to do: Table.AddColumn(Source, "I", each I([key], [secret])). This way, I've managed to call multiple times each pair key/secret through loop function I.

 

Thanks!

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

instead of List.Generate use Table.AddColumn - column from function call.

Hello, sorry for the delayed response, sudden shift in projects 😕

 

Your answer was on the right path. What I needed to do: Table.AddColumn(Source, "I", each I([key], [secret])). This way, I've managed to call multiple times each pair key/secret through loop function I.

 

Thanks!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.