This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I am calling "https://api.powerbi.com/v1.0/myorg/groups/{0}/reports/{1}/ExportTo" Api in my mvc application.
HttpWebRequest request = System.Net.HttpWebRequest.CreateHttp(string.Format("https://api.powerbi.com/v1.0/myorg/groups/{0}/reports/{1}/ExportTo", workspaceId,reportId1));
request.KeepAlive = true;
request.Method = "POST";
request.ContentType = "application/json";
request.Headers.Add("Authorization", String.Format("Bearer {0}", token));
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
string json = "{\"format\":\"PDF\"}";
streamWriter.Write(json);
}
var response = (HttpWebResponse)request.GetResponse();
Here i was getting access token like this,
string result = authContext.AcquireTokenAsync(resourceUriPowerBi, clientCredential).Result.AccessTok...
after this I got the error
{"error":{"code":"InvalidRequest","message":"Export report requires effective identity to be provided for the report's dataset"}}
then I write a code to get embed token by passing access level and identities i used at power bi Desktop to use RLS
string embedToken =
(await pbiClient.Reports.GenerateTokenInGroupAsync(workspaceId,
report.Id,
generateTokenRequestParameters)).Token;
Now I got the 403 forbidden error with no text.
Can anyone please help me to understand this why it is giving 403 error.
earlier i successfully called the refresh dataset api using access token got using client credential...
Tahnks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.