Forum Discussion

Tweeg's avatar
Tweeg
Helper I
4 years ago
Solved

Authenticate REST API

It looks like changes were made to the REST API.

The 'Try it' function from the page is gone so I tried do do it myself using Postman.

When authenticating with my service principle, a lot of API calls give me the following response: "Message": "API is not accessible for application".

 

So I have been trying to authenticate with my personal (admin) account, but how to do this is nowhere to be found in the documentation.

 

I found a workaround (open the PowerBI service in Chrome, then open a workspace and take the bearer token from the Developer Tools in chrome). But that can't be the way.

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Tweeg ,

    Actually, it is a known issue. The Power BI team is aware of this issue and is working on a fix. You can test the API by using an external API testing tool, such as the one you mentioned: Postman. There is no exact date for a solution yet, but I will update you with any progress later. You can check the following official documentation for details on this known issue.

    Known issue - Try it button missing on REST API pages

    Regarding the authorization issue you mentioned, you can refer to the below methods in this thread to resolve it.

    1. Call the GenerateToken API

    Power BI REST API using postman - generate embed token.

    Note: 

    1) You will likely need to create the App registration FOR YOUR ORGANIZATION (i.e. User Owns Data option)

    2) Make sure to record the Application Secret which is displayed on your screen after the app is registered

    3) When granting permissions in the Azure Portal, be sure to check "Grant Permissions for [Your Organization Name]"


    2. Extract token using Powershell

    Please follow below video to extract token using Powershell.
    https://www.youtube.com/watch?v=f7HLyiAk-lQ (Credits - Adam(#GuyInACube))

    Note - if you're using powershell for the first time, U will need to install Powerbi Module by running below command in Powershell as adminstrator.

    Install-Module -Name MicrosoftPowerBIMgmt


    Best Regards

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Tweeg ,

    Actually, it is a known issue. The Power BI team is aware of this issue and is working on a fix. You can test the API by using an external API testing tool, such as the one you mentioned: Postman. There is no exact date for a solution yet, but I will update you with any progress later. You can check the following official documentation for details on this known issue.

    Known issue - Try it button missing on REST API pages

    Regarding the authorization issue you mentioned, you can refer to the below methods in this thread to resolve it.

    1. Call the GenerateToken API

    Power BI REST API using postman - generate embed token.

    Note: 

    1) You will likely need to create the App registration FOR YOUR ORGANIZATION (i.e. User Owns Data option)

    2) Make sure to record the Application Secret which is displayed on your screen after the app is registered

    3) When granting permissions in the Azure Portal, be sure to check "Grant Permissions for [Your Organization Name]"


    2. Extract token using Powershell

    Please follow below video to extract token using Powershell.
    https://www.youtube.com/watch?v=f7HLyiAk-lQ (Credits - Adam(#GuyInACube))

    Note - if you're using powershell for the first time, U will need to install Powerbi Module by running below command in Powershell as adminstrator.

    Install-Module -Name MicrosoftPowerBIMgmt


    Best Regards

    • Tweeg's avatar
      Tweeg
      Helper I

      But then I am authenticating with an application right? And like I mentioned:

       

      When authenticating with my service principle, a lot of API calls give me the following response: "Message": "API is not accessible for application".

       

      I need to be able to authenticate with my personal user account. 

       

      The option to retrieve a key using powershell works, but thats via powershell and i would like to do it in postman/ any given API tool without putting powershell in between.