Forum Discussion
Uploading PBIX File in C# sample (HELP!)
- 7 years ago
Hi brunozanoelo
You don't need dedicated capacity now. It has no connection with the autentication.
Are you running behind the code behind any proxy ? Which blocks your autentication ?
Can you try executing in Post man ?
Hi brunozanoelo ,
I tried the same thing it works for me.
Here some few tips
- Check whether you user credentials (user name/password) having access to the workspace.
- Using the fiddler find what API is exactly calling and whether you are getting any error in the fiddler
I see that this is calling
https://api.powerbi.com/v1.0/myorg/groups
https://docs.microsoft.com/en-us/rest/api/power-bi/groups/getgroups
It requires the scope of Workspace.Read.All or Workspace.ReadWrite.All but from the screenshot you also having that
Hello my friend,
I´ve found that the problem is actually not in the workspace, but still in the authentication function.
See the image bellow. I think my code is correct, isn't? The client ID it´s the correct one, I already checked!
Auth not passed
- Jayendran7 years agoSolution Sage
Hi brunozanoelo
Yes pls use the fiddler to find what was the failure from the API. Since it's not reproduce from my side. Fiddler will get the exact issue here
- brunozanoelo7 years agoPost Patron
Success using the fiddler
More permissions
But in the app, the errorstill persist.
- Jayendran7 years agoSolution Sage
Hi brunozanoelo
Previously you said that autentication is not passed which means it should have a 200 status code. In such scenario you should see the error in fiddler.
However you said that fiddler is successful. It doesn't make sense !
However, Can you change your code to like the below
HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + AccessToken); client.DefaultRequestHeaders.Add("Accept", "application/json"); HttpResponseMessage response = client.GetAsync(restUri).Result; var content = response.Content.ReadAsStringAsync().Result; Console.WriteLine(content);this way you can get what is the result of the API.