Quantcast
Channel: Power Query topics
Viewing all articles
Browse latest Browse all 31165

PowerBI Rest API synchronous call in C#

$
0
0

Hi Everyone,

 

I want to refresh mutliple datasets synchornously using Rest API in C#. 2nd dataset refresh should be called only after 1st dataset refresh gets completed, Challenge which i face right now is, even before 1st gets completed, 2nd gets called and its getting SQL time out issue because of overload. 

 

1st dataset refresh takes minimum 30-45 mins and time might vary due to server load as well.  Please suggest how to handle this!!

 

HttpWebRequest request = System.Net.HttpWebRequest.CreateHttp(String.Format("https://api.powerbi.com/v1.0/myorg/groups/{0}/datasets/{1}/refreshes", groupId, datasetId));


//POST web request to create a datasource.
request.KeepAlive = true;
request.Method = "POST";
request.ContentLength = 0;

 

//Add token to the request header
request.Headers.Add("Authorization", String.Format("Bearer {0}", token));

 

//Write JSON byte[] into a Stream
using (Stream writer = request.GetRequestStream())
{
var response = (HttpWebResponse)request.GetResponse();
Console.WriteLine("Dataset refresh request {0}", response.StatusCode.ToString());
}


Viewing all articles
Browse latest Browse all 31165


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>