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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Loop through multiple pages in API using power query

Hi, 
I am trying to loop through multiple rows,
for example each request gives data of 1 agent, PFB
https://vcc-na8.8x8.com/api/stats/agents/{agent-id}/activities?d=2022-12-1&n={offset}
I want to loop through all agent id's at once. i know next steps like creating a duplicate table and custom invoke function etc.
but problem is creating the function out of the above URL,
Currently im trying to do this and it shows error,

Source = Xml.Tables(Web.Contents("https://vcc-na8.8x8.com",
[RelatedPath = "/api/stats/agents/"&(agent_id)&"/"activities?d=2021-12-1&n=1])),


Thanks,
saad.


 

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

A few things that seem incorrect:

  • It is RelativePath, not RelatedPath
  • The " after the / seems incorrect. Probably should be at the end.
  • The () around the agentid seems incorrect. Try without those.

 

Also, are you able to do it with a hard-coded value for agent id for to confirm your syntax is correct, before you start passing parameters into it?

 

[RelativePath = "/api/stats/agents/"&agent_id&"/activities?d=2021-12-1&n=1"])),

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.