【发布时间】: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;
任何帮助将不胜感激。
【问题讨论】: