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

Looping through an API calling using another table

Hi!

 

For a dashboard im building I need to retrieve data using an API. However, within the URL of the API I need to specify an ID-like number to retrieve descriptive values. An example:

 

HTTPS://WWW.API_LINK.COM/category_line/(ID)/line

 

I have a table filled with Category_ID which I need to retrieve the data using the API above. So what i'm trying to do is:

 

HTTPS://WWW.API_LINK.COM/category_line/ LOOP(Category[ID]) /line.

 

However, the Powery Query Editor keeps telling me that I cannot combine functions like this together.  Thus, I was wondering if there is any other (perhaps better) way of doing this WITHOUT changing the nature of the API.

 

Thanks so much in advance!

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

If your id is in a column called ID, you should be able to add a custom column with an expression like this.

 

= Web.Contents("HTTPS://WWW.API_LINK.COM/category_line/" & [ID] & "/line"

 

You many need to convert that column to text before this step, or use & Number.ToText([ID]) &

 

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


Anonymous
Not applicable

Hi Pat!

First of all, thank you for taking the time to reply!

 

I used your solution, however, it gives me the following error:

 

Expression.Error: We cannot apply operator & to types Text and List.
Details:
Operator=&
Left=https://www.api-link.com/api/category/
Right=[List]

 

this is the line I have in set:

Json.Document(Web.Contents(#"API URL"&"/api/Category_line/"&Number.ToText(category[id])

Thank you in advance for replying!

 

Kind regards,

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.