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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Post request to refresh dataset

Hi,

I want to create an app which would refresh my dataset when needed by using Power BI REST API post method https://api.powerbi.com/v1.0/myorg/datasets/{datasetId}/refreshes.

When I send POST request I get back response code "unauthorized". Can't figure out where should be a problem. I have all grants permisions for my app in Azure AD. I'm following this tutorial to get access token https://docs.microsoft.com/en-us/power-bi/developer/automation/walkthrough-push-data-get-token. For request I add header with token, body with "notifyOption" and path with my datasetId. Do I miss some parameters or I am using a wrong access token? 

 

My code sample

HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
var requestBody = new JObject();
requestBody["notifyOption"] = "";
var response = await httpClient.PostAsync(
"https://api.powerbi.com/v1.0/myorg/datasets/****datasetid***/refreshes",
new StringContent(requestBody.ToString(), Encoding.UTF8, "application/json"));
           



0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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