Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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"));
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 |