Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
syedahmad
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
v-jiascu-msft
Employee
Employee

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.

View solution in original post

11 REPLIES 11
v-jiascu-msft
Employee
Employee

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.

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

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.

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

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.

 

 

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. 

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.

 

 

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. 

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.

Sir, I already added the datasource as file(datasource type) succesfully but it couldn't be shown in the dataset list. 

 

When I trying that option(Add to Gateway) and submit the form I get the following  error :

Screenshot_7.png

 

 

can you explain me How I connect ms access file using On Premises Gateway and which type of authentication method I used for Oledb datasource type (Currently I use Basic ). 

 

 

 

Hi @syedahmad,

 

I would suggest you create a new post in this forum for us to investigate more. According to my experience, the username of the Windows could be like below. "ComputerName\Username" or "DomainName\Username". Please give it a try.

 

 

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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.