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
ryankang
Frequent Visitor

How to make function "download pbix file" in javascript??

Hello.


I just made code to show on the website but i want to make another function.. 
1) First, upload pbix file by using button or something if anyone who is authorized by login function.. or something else, if i upload pbix file to the web i can show the report either. 
2) Second, and i can download pbix file on the website by using button function. 

i just knew this function is possible to be made already, cause i other company made this kind of website..
so please let me know the way or website i can refer. 🙂 

thanks. 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @ryankang ,

 

Embedding and interacting with Power BI content (reports, dashboards and tiles) requires an access token. The access token can be either an Azure AD token, when embedding for your organization, or an embed token, when embedding for your customers. The access token has an expiration time, which means that after embedding a Power BI item, you have a limited amount of time to interact with it. To give your users a continuous experience, refresh (or renew) the access token before it expires.

There are two ways to refresh your access token:

  • Directly using the APIsetAccessToken
  • Automatically if you're using an Azure AD token for embed for your organization

For more details, please refer to:

Refresh the access token in Power BI embedded analytics | Microsoft Learn

 

Best Regards,

Jianbo Li

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
v-jianboli-msft
Community Support
Community Support

Hi @ryankang ,

 

Embedding and interacting with Power BI content (reports, dashboards and tiles) requires an access token. The access token can be either an Azure AD token, when embedding for your organization, or an embed token, when embedding for your customers. The access token has an expiration time, which means that after embedding a Power BI item, you have a limited amount of time to interact with it. To give your users a continuous experience, refresh (or renew) the access token before it expires.

There are two ways to refresh your access token:

  • Directly using the APIsetAccessToken
  • Automatically if you're using an Azure AD token for embed for your organization

For more details, please refer to:

Refresh the access token in Power BI embedded analytics | Microsoft Learn

 

Best Regards,

Jianbo Li

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

Hi @v-jianboli-msft 
I could make REST API code, and i can download pbix file on the website by pushing button.

but i dont get the way how to make auth token "Export report" automatically following the picture. 

ryankang_0-1666190641010.png

lastly, i can make that token automatically.. it would be the best 🙂 
thank you for replying so fast.. 

v-jianboli-msft
Community Support
Community Support

Hi @ryankang ,

 

According to my knowledge, you can achieve your goal by using REST API.

The Power BI REST APIs provide service endpoints for embedding, administration, governance and user resources.

With Power BI REST APIs you can do the following:

  • Manage Power BI content

  • Perform admin operations

  • Embed Power BI Content

If you want to upload and download report, please refer to:

Reports - Export Report In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn 

Imports - REST API (Power BI Power BI REST APIs) | Microsoft Learn 

 

Best Regards,

Jianbo Li

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

Hi @v-jianboli-msft 
thank you for replying.
i'd like to know how to operate authorization token by calling api automatically

when i use 'Export Report In Group' REST API. 
cause i always need to get "Bearer ~~(Code)~~" << this type of token manually following link you offer.
so i want to know the way to get Bearer Token on the javascript.

cause bearer token always seems to change regulary.. i can manage it manually 😞 

if you know the way or link to refer. 

thank you

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.