We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I am trying to use the REST API Dataset Refresh to programmatically update my datasets that are setup with incremental refresh. The rest api successfully kicks off the refresh of the models but for whatever reason it's not completely updating my models.
I have data for 5 years. The initial refresh should update all 5 years, and then theoretically update whatever changes in the future.
However, in my test model it updated 4 years completely but the missed July and AUgust of this year. I was able to manually update July and August using Tabular Editor. But I was under the impression that this should update the entire model up to yesterday.
RestClient client = new RestClient($"https://api.powerbi.com/v1.0/myorg/{workspaceGUID}/datasets/{datasetGUID}/refreshes");
RestRequest request = new RestRequest(RestSharp.Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer " + bearer);
request.AddJsonBody(new
{
type = "full",
commitMode = "transactional",
applyRefreshPolicy = false
});
IRestResponse response = client.Execute(request);Code used to update model is above.
Thank you Sahir_Maharaj
Hi, @Don-Bot
You can follow the following API documentation to pass in the corresponding partition to the request body to refresh the partition in the specified range:
Datasets - Refresh Dataset - REST API (Power BI Power BI REST APIs) | Microsoft Learn
If you do not refresh in July or August, you can specify this partition in the API and then refresh your data.
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Don-Bot,
The REST API for dataset refresh should trigger the incremental refresh based on the defined policy. Can you please try the following approach:
RestClient client = new RestClient($"https://api.powerbi.com/v1.0/myorg/{workspaceGUID}/datasets/{datasetGUID}/refreshes");
RestRequest request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer " + bearer);
// The 'applyRefreshPolicy' should be set to true for incremental refresh
request.AddJsonBody(new
{
applyRefreshPolicy = true
});
IRestResponse response = client.Execute(request);
if (response.StatusCode == System.Net.HttpStatusCode.OK)
{
Console.WriteLine("Refresh triggered successfully.");
}
else
{
Console.WriteLine($"Failed to trigger refresh: {response.Content}");
}
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.