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

Re: power bi java script API - Finally have access tokens but no staticReportUrl

$
0
0

I embed my own reports with a sample code as below. Replace the id, token and embed url with yourself's, save it as a html file and open it in Chrome/IE/FF.

<html><script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/jquery/dist/jquery.js"></script>  <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/powerbi-client/dist/powerbi.js"></script><script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/es6-promise/es6-promise.js"></script><script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/fetch/fetch.js"></script><script type="text/javascript">
window.onload = function () {
var embedConfiguration = {
    type: 'report',
    accessToken: 'yourtokenhere',
    id: '51309815-f35b-xxxx-acb8-bc7245cd8f0c',
    //for Power BI Embedded
	//embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed?reportId=734503cf-1309-4892-xxxx-791d62c15x44' 
	//for Power BI REST API
	embedUrl: 'https://msit.powerbi.com/reportEmbed?reportId=51309815-f35b-xxxx-acb8-bc7245cd8f0c'
}; 

var $reportContainer = $('#reportContainer');
 
var report = powerbi.embed($reportContainer.get(0), embedConfiguration);
  
report.fullscreen();  

}
</script><div id="reportContainer"></div></html>

 


Viewing all articles
Browse latest Browse all 49116

Trending Articles



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