JavaScripts 必需 jquery.js powerbi.js
我假设您已经构建了本机应用程序,并且已经提供了所有必需的 Power BI Access。如果没有,请参考下面的步骤 A 到 C。
我使用了这个链接上提到的步骤。我修改了一下以重复使用令牌直到它过期。只有在过期后,我们才会生成新的令牌 http://community.powerbi.com/t5/Developer/Rest-api-usage -with-Java/mp/58514#M1841 此应用程序将为收到的 REST 调用提供 AAD 令牌
在需要嵌入报告的应用程序的 JSP 页面上为报告创建 DIV
div id="reportContainer" class="reportContainer"
获取 AAD 令牌
对在步骤 1 中开发的应用程序进行 REST 调用获取 AAD 令牌
我的 aadToken 对象有 2 个参数 accessToken 和 expiresAtStr
var aadToken={accessToken:' ',expiresAtStr: ''};
function getAadAccessToken() {
var deferred = $q.defer();
$http.get('/MyPowerBIApp/REST/getAadToken/')
.then(
function (response) {
deferred.resolve(response.data);
},
function(errResponse){
console.error('Error while getting Aad Access Token');
deferred.reject(errResponse);
}
);
return deferred.promise;
}
Run Code Online (Sandbox Code Playgroud)
从 REST …