我正在嘗試通過 Power BI 連接到 web 服務,但我仍然沒有達到結果,首先嘗試使用 Web 資料源并使用高級使用添加在我的情況下的標題,Content-Type它的值是application/json和附加的我有一個令牌

結果我得到以下結果:

另外還嘗試使用“空白查詢”作為源,我在其中訪問了高級編輯器部分并添加了以下查詢:

我得到以下錯誤:

為了確保 Web 服務正常作業并獲得結果,我使用了 Advanced REST Client 工具并進行了以下配置:

您可以在其中看到我添加了Header name Content-Type 的 Headers 部分和 is 的值Header Value,application/json在該Body部分中我添加了token

有了這個,我意識到我的 Webservice 得到了答案并且服務正常作業,我希望有人在短時間內給我一些指導以正確執行
uj5u.com熱心網友回復:
提供內容以將方法從 GET 切換到 POST,例如
對 URL 執行 POST,傳遞二進制 JSON 有效負載并將回應決議為 JSON。
https://docs.microsoft.com/en-us/powerquery-m/web-contents#example-2
let
url = "https://postman-echo.com/post",
headers = [#"Content-Type" = "application/json"],
postData = Json.FromValue([token = "abcdef"]),
response = Web.Contents(
url,
[
Headers = headers,
Content = postData
]
),
jsonResponse = Json.Document(response),
json = jsonResponse[json]
in
json
或者
let
url = "https://postman-echo.com/post",
headers = [#"Content-Type" = "application/json"],
postData = Text.ToBinary("{ ""token"":""abcdef""}"),
response = Web.Contents(
url,
[
Headers = headers,
Content = postData
]
),
jsonResponse = Json.Document(response),
json = jsonResponse[json]
in
json
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/491374.html
