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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
vivinj
Frequent Visitor

Error while executing Get dataset call "API is not accessible for application"

Hi,
 
I am trying to execute the API calls for Power BI on Postman. I was able to successfully generate the token using the service principal method. Now when I try and execute a GetDataset call in Postman it gives me an error "API is not accessible for application".
My perception is that i missed on some specific permission for postman in Power BI or Azure. The online docs and articles didn't say much about the postman specific permission but I might be wrong in presuming that.

 

Get dataset call error.PNG

 

Any help with this is greatly appreciated.

Let me know if you have any questions.

 

Thanks & Regards,

Vivin

1 ACCEPTED SOLUTION

@zoloturu 

I was able to find the reason why. This was because I was trying to work on the data form My Org and this is a limitation in the Service Principal method:

Considerations and limitations

My Workspace isn't supported when using service principal.

 

I am sorted now thanks for teh help.

View solution in original post

12 REPLIES 12
shubh43
Regular Visitor

The URL in the Microsoft API documentation is wrong for service principals.

You need to also include the workspace ID in the URL, see below

 

https://api.powerbi.com/v1.0/myorg/groups/{WorkspaceID}/reports/{reportId}/exports

For me as well, thanks! But c'mon how is one supposed to find this...? Trial and error? 

This fixed the issue for me. Thanks a lot!

zoloturu
Memorable Member
Memorable Member

Hi @vivinj ,

 

First of all, Postman is just a tool and doesn't require specific permissions in order to use to Power BI API.

I think your Authorization token was generated with some restrictions. 

 

When you registered an App, did you select all options?

register an app.JPG

 

 

 

 

 

 

 

 

 

 

For one time you can get an Authorization token with full rights simply via Chrome Developer Tools (F12) or other similar:

1. Open Power BI Service in Chrome Browser.

2. Press F12. DevTools window should appear.

3. Navigate in Power BI Service to any workspace. (If you were there, then redo, just need to run this action)

4. Go to DevTools -> Network tab , try to find any request, where Headers contain authorization. And that will be your Authorization token (valid for an hour).

 

On the screen shot below I found a request called 'SharedDatasets'. But for instance, 'subsribe' also a good one.

authorization_token.png

 

 

 

 

 

 

 

 

 

So I got a token, then I go to Postman and everythin works properly:

postman get datasets.png

 

 

 

 

 

 

 

 

So I recommend to try to run your request using a method I provided, just to verify if your API request is written properly. And then if that works you can correct an App in Azure with proper permissions.

 


Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups

@zoloturu  thanks for the response. The Get call worked exactly as you said if I use the token form the Network logs and the call was successful.

 

My Problem now is which/where am I missing the permission that will allow me to us the the token that i generate rather than pulling it up from Network logs? I remember selecting all the permissions when I registered the app and the Azure portal has also has the necessary rights for my app to make the call successfully. So not sure what am i missing here.

image (3).png

 

Thanks & Regards,

Vivin

@vivinj ,

 

Let's try to collect a Fiddler trace.

1. If you don't have it, then install - https://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/InstallFiddler

2. Open Fiddler
3. Select "Edit -> Remove -> All Sessions"
4. Reproduce the issue in your Postman
5. There should be some red lines when API request runs. Post a screen shot of that.


Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
It was useful? Press Thumbs Up!

You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups

Anonymous
Not applicable

Rakesh_Chandra9_0-1648981501060.png

Facing this error in fiddler. HTTPS handshake failed

@zoloturu 

I was able to find the reason why. This was because I was trying to work on the data form My Org and this is a limitation in the Service Principal method:

Considerations and limitations

My Workspace isn't supported when using service principal.

 

I am sorted now thanks for teh help.

Hi, I've got the same issue. What did you replace the "MyOrg" with?

I alos met this problem. Thanks for your sharing. It works when using workspace API. 

Do you know what should be added when using APP API: https://learn.microsoft.com/en-us/rest/api/power-bi/apps/get-reports 

 

I see apps API not support principal account:

Limitations

Service principal authentication isn't supported.

 

 

Don't know why Power BI has this kind of limitation. 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.