cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
syedahmad Frequent Visitor
Frequent Visitor

Report and Dashboard not render on my webpage

Hi,

 

 

I want to embed the PowerBi Reports & Dashboards in my web application by using PHP Curl and JavaScript Api. For that, I already create azure account and also registered the application in PowerBi. I get all the list of reports and dashboards which are already creted in my powerbi desktop but when I call for a report by using embed url I got the response as:

 

"This content isn't available"
Learn more about Power BI.

 

You can check this here : http://quizgeny.com/arquam/testing.php

 

My code for calling the reports after getting embedded token is :

<?php
$curlGetUrl = curl_init();
curl_setopt_array($curlGetUrl, array(

CURLOPT_URL => "https://api.powerbi.com/v1.0/myorg/reports",

CURLOPT_RETURNTRANSFER => true,

CURLOPT_ENCODING => "",

CURLOPT_MAXREDIRS => 10,

CURLOPT_TIMEOUT => 30,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

CURLOPT_CUSTOMREQUEST => "GET",

CURLOPT_HTTPHEADER => array(

"Authorization: $embeddedToken",

"Cache-Control: no-cache",

),

));

$embedResponse = curl_exec($curlGetUrl);

$embedError = curl_error($curlGetUrl);

curl_close($$curlGetUrl);


if ($embedError) {

echo "cURL Error #:" . $embedError;

} else {

$embedResponse = json_decode($embedResponse, true);

$embedUrl = $embedResponse['value'][0]['embedUrl'];

$reportId = $embedResponse['value'][0]['id'];

}
?>

<script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript" language="javascript" src="https://rawgit.com/Microsoft/PowerBI-JavaScript/master/dist/powerbi.min.js"></script>
<script src="https://rawgit.com/Microsoft/PowerBI-JavaScript/master/dist/powerbi.js"></script>

<h1>Power BI Embedded Demo</h1>
<div id="reportContainer" style="width: 80%; height: 800px;"></div>
<script>

var accessToken = "<?php echo $token?>";


var embedUrl = "<?php echo $embeddedUrl?>";


var embedReportId = "<?php echo $reportId?>";


var models = window['powerbi-client'].models;


var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
reportId: embedReportId,
permissions: models.Permissions.All,

};

var reportContainer = document.getElementById('reportContainer');
var report = powerbi.embed(reportContainer, config);
</script>

 

 


Please give me the solution for this issue.

 

 

Thank You

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Report and Dashboard not render on my webpage

Hi @syedahmad,

 

I'm almost sure the cause is the expiration of the token. As far as I know, the token will expire in one hour. You can replace the token with a new token for a test. You also need to find a way to refresh the token automatically. 

I also found something else in the source code. The token is an AAD token rather than an Embed token. Please refer to power-bi/embedtoken and https://www.youtube.com/watch?v=GPHHdDRSlis for how to get the embed token. 

 

tokenType: models.TokenType.Embed,

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
11 REPLIES 11
Community Support Team
Community Support Team

Re: Report and Dashboard not render on my webpage

Hi @syedahmad,

 

I'm almost sure the cause is the expiration of the token. As far as I know, the token will expire in one hour. You can replace the token with a new token for a test. You also need to find a way to refresh the token automatically. 

I also found something else in the source code. The token is an AAD token rather than an Embed token. Please refer to power-bi/embedtoken and https://www.youtube.com/watch?v=GPHHdDRSlis for how to get the embed token. 

 

tokenType: models.TokenType.Embed,

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
syedahmad Frequent Visitor
Frequent Visitor

Re: Report and Dashboard not render on my webpage

Hi Sir,

 

Thanks a lot I have done. Sir, I want to know that I can we integrate MS Access database in PowerBi  for datasets as we integrate the excelsheets (in worbooks) in which the changes are made from anywhere(Like Cloud Apps).

 

Please tell me about that, how we can impletent it or any other solution for integrating access database in powerbi.

 

 

Thank You

Community Support Team
Community Support Team

Re: Report and Dashboard not render on my webpage

It's my pleasure.

 

What kind of integration would you like? If you use Access database as a data source, you can just connect it from Power BI Desktop using the Access connector. 

Report-and-Dashboard-not-render-on-my-webpage

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
syedahmad Frequent Visitor
Frequent Visitor

Re: Report and Dashboard not render on my webpage

Hi Sir,

 

 

Thanks Sir, But Sir if I connect access with PowerBi desktop then changes could be available on cloud(Means when changes made in access datasets then changes reflect in PowerBi Web reports accordingly )?

 

Thanks

Community Support Team
Community Support Team

Re: Report and Dashboard not render on my webpage

Yes, you have to refresh the dataset in the Service by either the manually refresh or the scheduled refresh. Please refer to power-bi/refresh-data#databases-in-the-cloud and the snapshot below. The gateway is also needed. 

Report-and-Dashboard-not-render-on-my-webpage2

 

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
syedahmad Frequent Visitor
Frequent Visitor

Re: Report and Dashboard not render on my webpage

 

 

Thanks Sir, But When I click on GetData->OneDrive for Business in powerBi Web Service then the excelfiles and some folders are shown, MS Access files, which are stored on onedrive, are not shown. Please tell me about the reason behind that and how I can resolve it. 

Community Support Team
Community Support Team

Re: Report and Dashboard not render on my webpage

Hi @syedahmad,

 

I'm afraid the MS Access file isn't supported in that way. Please refer to service-connect-to-files-in-app-workspace-onedrive-for-business#2-import-excel-files-as-datasets-or-....

I would suggest you create an idea here.

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
syedahmad Frequent Visitor
Frequent Visitor

Re: Report and Dashboard not render on my webpage

 

 

Thanks Sir. When I am using Onpremises Gateway and trying to connect to access file, the follwing error is shown :

Screenshot_5.png

 

 

Please give me the solution for the problem. 

Community Support Team
Community Support Team

Re: Report and Dashboard not render on my webpage

Hi @syedahmad,

 

The status of Gateway is "Not configured correctly". That means you need to configure the data source first. Did you notice the "Add to gateway" at the end of the error message? You can click it to get there. Or you can go there through the menu. Please refer to the snapshot below.

Report-and-Dashboard-not-render-on-my-webpage3

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.