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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors