cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sato89 Regular Visitor
Regular Visitor

Power BI Server and REST calls by angular app

Hi everyone,

I installed an instance of Power BI Server with some reports on a computer and I can view the reports in embed version inside a web-app by adding the parameter "?rs:embed=true" to the report URL in a iframe. My PBI Server is installed with Evaluation License.

Can I use REST API to get reports from my Power BI Server? Note that my reports are on my Server and not on app.powerbi.com.

Can I get this functionality with an Evaluation for the moment or is the Premium license necessary to call my PBI Server via REST from my angular web-app?

 

Thanks in advance.

Best regard.

 

Salvatore

2 ACCEPTED SOLUTIONS

Accepted Solutions
harikishant Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

The simplest of the PBIRS API calls is as shown in the screenshot. 

14-12-2018 3-54-48 PM.jpg

Here is the code if you want to invoke the same API call using PowerShell 

 

$Cred = Get-Credential
$Url = "http://powerbi.local/Reports/api/v2.0/Me"
#Invoke-RestMethod -Method 'GET' -Uri $Url -UseDefaultCredentials -OutVariable UserContext
Invoke-RestMethod -Method 'GET' -Uri $Url -Credential $Cred -OutVariable UserContext
echo $UserContext

 

 

Here is the list of PBI RS APIs that you can play with.

 

Please accept the solution, if you agree.

 

Cheers,

Hari T

 

 

View solution in original post

harikishant Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

You can set your cedentials at the GET request level by choosing the Authorization method as "NTLM Authentication".

 

This is when you are on windows and using Windows Authentication. You can also set the Domain of your Org. in the advanced properties.

 

Cheers,

Hari T

View solution in original post

9 REPLIES 9
Jon-Heide Established Member
Established Member

Re: Power BI Server and REST calls by angular app

There is no functional difference between evaluation edition and full enterprise, aside from a timebomb and licensing rules. You can use the evaluation edition for purposes of dev/test and demo's. Running it in any production evironment will require the appropriate SQL enterprise core or PowerBI premium licenses.  

sato89 Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

Thank you for your reply!

So, how can I obtain the embedded token for my REST calls to PBI Server? I tried to implement a REST call from an Angular app but I didn't know the correct way to get this token.

My reports are published on a PBI Server instead of PBI Services (app.powerbi.com).

 

Thank you!

Best regards.

harikishant Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

I haven't tried Angular to make the Rest Api calls but used powershell/postman to make the calls. You can set the security context at the request level or Collection level while making an API call. This worked like a charm for me.

 

Cheers,

Hari T

Highlighted
sato89 Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

Thank you Harikishant.
Can you give me an example please?
harikishant Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

The simplest of the PBIRS API calls is as shown in the screenshot. 

14-12-2018 3-54-48 PM.jpg

Here is the code if you want to invoke the same API call using PowerShell 

 

$Cred = Get-Credential
$Url = "http://powerbi.local/Reports/api/v2.0/Me"
#Invoke-RestMethod -Method 'GET' -Uri $Url -UseDefaultCredentials -OutVariable UserContext
Invoke-RestMethod -Method 'GET' -Uri $Url -Credential $Cred -OutVariable UserContext
echo $UserContext

 

 

Here is the list of PBI RS APIs that you can play with.

 

Please accept the solution, if you agree.

 

Cheers,

Hari T

 

 

View solution in original post

sato89 Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

Thank you! Great!!! Last question: what is the ID in the body and where I can find it? Is it the ID of my report? On PBI report server I cannot find it!
harikishant Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

The GET call in my example returns the User Context properties. 

To answer your question, it is the UserID which is stored as GUID in ReportServer metadata.

 

Cheers,

Hari T

sato89 Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

Hi Harikishant. Thank you.

I want to accept your answer as a solution, but there is still something missing!

Are you speaking about the "UserID  field in "Users" table into the PBI Server database?

However, in my case, I receive "401 Unauthorize".

I sent a GET request with Postman to PBI Server WebPortal URL and WebService URL without body and with only "Content-Type"="application/json" as Header.

My question is: where should I set the credentials before send the request to obtain the authorization?

 

Many thanks.

harikishant Regular Visitor
Regular Visitor

Re: Power BI Server and REST calls by angular app

You can set your cedentials at the GET request level by choosing the Authorization method as "NTLM Authentication".

 

This is when you are on windows and using Windows Authentication. You can also set the Domain of your Org. in the advanced properties.

 

Cheers,

Hari T

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 6 members 1,296 guests
Please welcome our newest community members: