我嘗試通過 Microsoft 的 PowerBI Client NuGet Package 封裝我們的 PowerBI Server REST API。我遇到了 URI 添加了錯誤的相對路徑的問題。我們的報告服務器(本地)的 REST API 有一個基本 URI,如:https : //niceReportingURL.com/reports/api/v2.0 但 NuGet 包在 URI 中添加了另一個“/v1.0/myorg” ,這是不必要的。
因此,請求 URI 如下所示:https ://niceReportingURL.com/reports/api/v2.0/v1.0/myorg
我在“ReportsOperations”類的源代碼中看到,這個奇怪的相對 URI 被硬編碼了!
string uriString = new Uri(new Uri(absoluteUri (absoluteUri.EndsWith("/") ? "" : "/")), "v1.0/myorg/reports").ToString();
我在示例 URI 中省略了“/Reports”,因為它看起來像是一個普遍問題。是否有 NuGet 包不添加此相對 URI 的選項或解決方法?
請求如下所示:
var c = new BasicAuthenticationCredentials
{
UserName = "reportingUser",
Password = "secretReportingPW"
};
var client = new PowerBIClient(new Uri("https://niceReportingURL.com/reports/api/v2.0"), c);
var result = await client.Reports.GetReportsAsync().ConfigureAwait(false); // Here comes the fail
uj5u.com熱心網友回復:
PowerBI 客戶端包封裝了對PowerBI REST API的訪問。
此 API 與Reporting Services REST API不同,后者似乎沒有現成的 NuGet 包來封裝它,但確實有一個易于使用的 OpenAPI 規范。
這兩個 API 都有用于檢索報告的端點,但它們是不同型別的報告。令人困惑的是,微軟選擇在 PowerBI 生態系統中將 Reporting Services 重新命名為“分頁報告”,因此至少可以使用 PowerBI REST API 檢索一些Reporting Services 報告。但是,對于由本地 Reporting Services 實體托管的報表,您需要 Reporting Services API 并且不能使用 PowerBI REST API。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/495625.html
下一篇:可空背景關系在C#中無法正常作業
