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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
NicolasLJ
Frequent Visitor

Power BI API : GET Refresh works, but POST does not

Hi,

 

I'm testing Dataset refresh through API with Postman.

I created and registered an app in AD with Dataset.ReadWrite.All Granted

When I send a GET resquest with a Bearer Token I get the history of refresh of the data set, but just changing the GET to a POST refresh to trigger a refresh send me back this answer :

 

{
    "error": {
        "code": "ItemNotFound",
        "message": "Dataset xxxxxx is not found! please verify datasetId is correct and user have sufficient permissions."
    }
}
 
 
Url and parameters are exactly the same, how the get can find the dataset but not the post ???
2 ACCEPTED SOLUTIONS
aj1973
Community Champion
Community Champion

I was trying to save you time but it seems like you insist on using Postman. So please verify this

https://nonodename.com/post/pbirestapi/#:~:text=First%20of%20all%2C%20got%20to,can%20be%20plugged%20....

Then verify that you added the App registration to a security group and at the tenant level

https://learn.microsoft.com/en-us/fabric/admin/service-admin-portal-admin-api-settings#enhance-admin...

 

You should also know that a new token is generated every hour and you can only use POST https://api.powerbi.com/v1.0/myorg/datasets/xxxxx/refreshes up to 8 times a day for a shared workspace capacity, just like you schedule a refresh in the service.

 

So if you are planning on using retool.com then you know what to expect. 

However I would recommend that you use Power Automate to create a button in your reports for an unlimitted on-demand refreshes.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

View solution in original post

aj1973
Community Champion
Community Champion

Here you go

Trigger a cloud flow from any Power BI report - Power Automate | Microsoft Learn

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

View solution in original post

7 REPLIES 7
aj1973
Community Champion
Community Champion

Hi @NicolasLJ 

Did you the App Registration ID to the workspace where the dataset is located?

Did allow the App to use API in the tenant le evel?

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Note : I use pro licence, I don't have a premium capacity.

 

I added the App and the group assigned to the app into the workspace as admin.

A is the security group assigned to the service principal and P is the Service principal.

 

NicolasLJ_1-1701009255366.png

 

I assigned Dataset.ReadWrite.All role in Azure and Granted by admin (Delegated)

 

NicolasLJ_0-1701009169596.png

My POST API setup :

 

NicolasLJ_2-1701009390254.pngNicolasLJ_4-1701009458007.png

 

NicolasLJ_6-1701009519755.png

 

And the answer :

NicolasLJ_8-1701009609809.png

 

aj1973
Community Champion
Community Champion

Hi @NicolasLJ 

The App registration doesn't need  Bearer tokens to connect to the service. You need to use your App Regsitration in a local machine and Powershell to execute the script.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

I will provide more context :

My objective is to add a button to refresh on demand a dataset in a low code application build with retool.com

 

My setup :

- An App registered in AD (Service principal) with all permissions required and granted by admin

- My app is admin in my PBI workspace

- My Retool App will authenticate with the app id and secret through Oauth2 authentification flow

- Before coding the API orchestration in retool I try to test the all flow with Postman to ensure everything is well configured in Azure and PBI.

 

I succesfully :

- get the token

- get historical refresh info from a GET request to https://api.powerbi.com/v1.0/myorg/datasets/xxxxx/refreshes

(I replaced dataset id with xxxxx in this message for confidentiallity)

 

But when I POST to the same url with same auth token, I got ta response with this body in Postman :

 

{
    "error": {
        "code": "ItemNotFound",
        "message": "Dataset xxxxx (I replaced by dataset id in this message for confidentiallity) is not found! please verify datasetId is correct and user have sufficient permissions."
    }
}
aj1973
Community Champion
Community Champion

I was trying to save you time but it seems like you insist on using Postman. So please verify this

https://nonodename.com/post/pbirestapi/#:~:text=First%20of%20all%2C%20got%20to,can%20be%20plugged%20....

Then verify that you added the App registration to a security group and at the tenant level

https://learn.microsoft.com/en-us/fabric/admin/service-admin-portal-admin-api-settings#enhance-admin...

 

You should also know that a new token is generated every hour and you can only use POST https://api.powerbi.com/v1.0/myorg/datasets/xxxxx/refreshes up to 8 times a day for a shared workspace capacity, just like you schedule a refresh in the service.

 

So if you are planning on using retool.com then you know what to expect. 

However I would recommend that you use Power Automate to create a button in your reports for an unlimitted on-demand refreshes.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Ho, I'm really interested by the Power automate option, can we do that with the free tier of power automate ?

aj1973
Community Champion
Community Champion

Here you go

Trigger a cloud flow from any Power BI report - Power Automate | Microsoft Learn

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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