Forum Discussion
Power BI embedded - switch to premium in php application
- 8 years ago
insoldev wrote:
Is it effectively the same, though pointing to a app workspace, rather than a workspace collection?
No, It is pretty different. They use two sets of REST APIs, not to mentions the SDKs. In the new Power BI Embedded based on Azure SKU, it uses the these Power BI REST APIs.
As to your case, I don't know PHP, however I think below demo in HTML and REST API can work regardless of any coding languages.
Simply you can embed report in a HTML like.
<html> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script> <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script> <script type="text/javascript"> window.onload = function () { // Read embed application token from Model var accessToken = "Embedtoken starts with H4sIxxx"; // Read embed URL from Model var embedUrl = "https://app.powerbi.com/reportEmbed?reportId={reportid}&groupId={groupid}"; // Read dashboard Id from Model var embedReportId = "{reportid}"; // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; var config = { type: 'report', tokenType: models.TokenType.Embed, accessToken: accessToken, embedUrl: embedUrl, id: embedReportId , pageView: "oneColumn", settings: { filterPaneEnabled: true } }; // Get a reference to the embedded dashboard HTML element var dashboardContainer = $('#reportContainer')[0] ; // Embed the dashboard and display it within the div container. var report = powerbi.embed(dashboardContainer, config); } </script> <div id="reportContainer"></div> </html>You can get the reportid from the forementioned REST APIs. As to embed token, you can reference my reply in this thread.
Is it effectively the same, though pointing to a app workspace, rather than a workspace collection?
insoldev wrote:
Is it effectively the same, though pointing to a app workspace, rather than a workspace collection?
No, It is pretty different. They use two sets of REST APIs, not to mentions the SDKs. In the new Power BI Embedded based on Azure SKU, it uses the these Power BI REST APIs.
As to your case, I don't know PHP, however I think below demo in HTML and REST API can work regardless of any coding languages.
Simply you can embed report in a HTML like.
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
<script type="text/javascript">
window.onload = function () {
// Read embed application token from Model
var accessToken = "Embedtoken starts with H4sIxxx";
// Read embed URL from Model
var embedUrl = "https://app.powerbi.com/reportEmbed?reportId={reportid}&groupId={groupid}";
// Read dashboard Id from Model
var embedReportId = "{reportid}";
// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;
var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: embedReportId ,
pageView: "oneColumn",
settings: {
filterPaneEnabled: true
}
};
// Get a reference to the embedded dashboard HTML element
var dashboardContainer = $('#reportContainer')[0] ;
// Embed the dashboard and display it within the div container.
var report = powerbi.embed(dashboardContainer, config);
}
</script>
<div id="reportContainer"></div>
</html>
You can get the reportid from the forementioned REST APIs. As to embed token, you can reference my reply in this thread.
- insoldev8 years agoHelper I
Thanks Eric - I don't have time to verify, though that is really helpful.