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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
new2pbix
Frequent Visitor

Calling multiple API Endpoints in single Query

I have created a blank query in Power BI and have successfully tested the pulling of a single url with this basic API call syntax. My problem is that I want to pull the json content of possibly hundreds of URL endpoints into a single table. Here's my syntax:

 

Let

    url = “insert url here”,

    token = “insert token here”,

    timeout = 10,

 

   data = Table.FromRecords(

        Json.documents(

             Web.Contents(

                   url,

                         [

                                 Headers =

                                 [

                                             #”Authorization”=”Bearer “ “&token,

                                             #”Content-Type”=”application/json”

                                  ],

                                 Timeout = #duration(0,0,timeout,0)

                         ]

                   )

             )

        )

In

   data

 

Apologies for spacing.. I typed it freehand, directly from my template. Also everything I am pulling is json, so no worries on dealing with any other format. 
when url equals for example /v1/students/{id}/details where {id} is the unique student identifier, lets say those are 1,2,3,4,5,6...1000. The total number of students is arbitrary. I can successfully pull the content from /v1/students/1/details and /v1/students/2/details etc... on an individual basis...
I tried concatenating URLs similar to this: 

url = "https://blahblahdotblah/thing/api/v1/students/1/details","https://blahblahdotblah/thing/api/v1/students/2/details","https://blahblahdotblah/thing/api/v1/students/3/details", and i have played around with ( ) and all of these things break. 

I need to know how to call multiple URLs into 1 table....  pulling 1000 tables (one per query) and then joining/apending them on the backend will be very resource intensive and may not provide me much benefit.

 

Extra points for a speedy solution 🙂

Seriously though, I do thank you in advance for your prompt response. This project is of utmost priority in my world. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @new2pbix 

 

As your URLs have a predictable structure that only the student identifier is different, you can refer to the solution from the following blog written by Mynda Treacy. 

Scrape Data from Multiple Web Pages with Power Query • My Online Training Hub

 

The main steps include:

  1. Convert the current query for pulling a single url to a function that can be executed for each API url
  2. Generate a list of student identifier numbers and convert it into a table
  3. Execute the function for each student identifier number

 

For detailed steps, please refer to the above blog. Let me know if you have any question.

 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @new2pbix 

 

As your URLs have a predictable structure that only the student identifier is different, you can refer to the solution from the following blog written by Mynda Treacy. 

Scrape Data from Multiple Web Pages with Power Query • My Online Training Hub

 

The main steps include:

  1. Convert the current query for pulling a single url to a function that can be executed for each API url
  2. Generate a list of student identifier numbers and convert it into a table
  3. Execute the function for each student identifier number

 

For detailed steps, please refer to the above blog. Let me know if you have any question.

 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.