【问题标题】:Unable to get embed token of power bi report in php after successfully generating its access token成功生成访问令牌后无法在 php 中获取 power bi 报告的嵌入令牌
【发布时间】:2018-09-19 10:00:08
【问题描述】:

我正在使用 get/post 请求在 php 中生成 powerbi 报告的嵌入令牌,并且我按照此链接https://community.powerbi.com/t5/Developer/How-To-Get-embed-token-using-Get-Post-only/td-p/294475 中给出的示例成功生成了访问令牌,但是当我使用此访问令牌生成嵌入令牌时我它返回空数组作为响应。这是我的代码

$headers = array(
    "Authorization: Bearer <acesstoken generated>"
);

$url = 'https://api.powerbi.com/v1.0/myorg/groups/<group-id>/reports/<report-id>/GenerateToken';
$post_params = array(
    'accessLevel' => 'View',
    'datasetId'=>'<dataset-id>'     
);

$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_params);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers );

curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
echo $response;

任何帮助将不胜感激。

【问题讨论】:

    标签: php powerbi


    【解决方案1】:

    经过 1 天的努力,我终于发现我在资源参数中使用 application id 来生成访问令牌,而不是这个 https://analysis.windows.net/powerbi/api 链接。所以当我使用这个链接时,问题就解决了,并成功生成了嵌入令牌。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-31
      • 2017-06-22
      • 2020-08-11
      • 2023-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多