Forum Discussion

ryankang's avatar
ryankang
Frequent Visitor
3 years ago
Solved

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. 

  • 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.

4 Replies

  • 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.

    • ryankang's avatar
      ryankang
      Frequent Visitor

      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. 

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

  • 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.

    • ryankang's avatar
      ryankang
      Frequent Visitor

      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