Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 49652

Re: REST with Reports Fine with Groups 403 Forbidden Error

$
0
0

Hi Eric_Zhang

 

Thanks for the reply.

 

Yes I can get get the reports from a group with the Group ID as per your example endpoint

 

https://api.powerbi.com/v1.0/myorg/Groups/{groupid}/Reports

 

However the Power BI API says I should be able to get a list of groups with the following

 

https://api.powerbi.com/v1.0/myorg/Groups

 

I've tried the example code provided by the "Power BI API" site

 

using System;using System.Net.Http;var baseAddress =newUri("https://api.powerbi.com/");using(var httpClient =newHttpClient{ BaseAddress = baseAddress }){  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("authorization","Bearer tokenString");using(var response =await httpClient.GetAsync("v1.0/myorg/groups")){string responseData =await response.Content.ReadAsStringAsync();}

 

 

However I get an error for the authentication about needing to supply the client secret which I'm currently trying to work out how to provide in a console app.

 

It seems that installing the NuGet Package using the following as per the instructions on Power BI Developer site at the bottom

 

Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory

 

Then gives an compile issue that the AuthenticationContext class doesn't contain a method called AcquireToken. This means that the code from the Power BI Developer Site needs updating to show how to include the 'Client Secret'.

 

I can't seem to find a working code example to authenticate with the latest packages and get a list of the Groups.

 

Thats the difficulties of my morning Eric hows yours going?

 


Viewing all articles
Browse latest Browse all 49652

Trending Articles



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