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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
sthatoju
New Member

Rest API as data Source - Use Case

Hello Experts,

 

Could anyone please guide me on how to pull the data from the Rest API.

 

I have a list of APIs, which will connect through a login token(bearer token) and I want to pull the data to Power BI Desktop to build 

 

Thanks

Santhosh

2 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@sthatoju 

You can connect using Power Query, the genral format will be:

let
    BearerToken = "YOUR_BEARER_TOKEN",
    ApiUrl = "https://api.example.com/data",
    Source = Web.Contents(ApiUrl,
        [
            Headers = [Authorization = "Bearer " & BearerToken]
        ]
    ),
    JsonResponse = Json.Document(Source)
in
    JsonResponse

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

Anonymous
Not applicable

Hi @sthatoju , hello Fowmy, thank you for your prompt reply!

 

I agree with Fowmy, and as a supplement,let's see how we can leverage the API in Power Query via web.contents:

 

Web.Contents is a powerful function in Power Query that enables you to retrieve web content directly, without the need for a browser.

 

This function is especially beneficial for accessing APIs that return data in formats such as JSON or CSV.

 

By utilizing the Authorization header along with your bearer token, you can securely access protected resources, ensuring that your data retrieval is both efficient and secure.

 

I hope the following article is helpful:
Web.Contents and APIs in Power BI

 

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @sthatoju , hello Fowmy, thank you for your prompt reply!

 

I agree with Fowmy, and as a supplement,let's see how we can leverage the API in Power Query via web.contents:

 

Web.Contents is a powerful function in Power Query that enables you to retrieve web content directly, without the need for a browser.

 

This function is especially beneficial for accessing APIs that return data in formats such as JSON or CSV.

 

By utilizing the Authorization header along with your bearer token, you can securely access protected resources, ensuring that your data retrieval is both efficient and secure.

 

I hope the following article is helpful:
Web.Contents and APIs in Power BI

 

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



Fowmy
Super User
Super User

@sthatoju 

You can connect using Power Query, the genral format will be:

let
    BearerToken = "YOUR_BEARER_TOKEN",
    ApiUrl = "https://api.example.com/data",
    Source = Web.Contents(ApiUrl,
        [
            Headers = [Authorization = "Bearer " & BearerToken]
        ]
    ),
    JsonResponse = Json.Document(Source)
in
    JsonResponse

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thanks @Fowmy  for your reply.

 

I will try it out. However, could you please confirm me that, this power query setup will work for the endusers(consumers), who will run the report.

 

I want to build a report and deliver to the end users.

 

Thanks

Santhosh

@sthatoju 

It should as you use a token to authenticate

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors