嘗試發出 POST 請求時,我總是收到以下錯誤:
DataSource.Error: Web.Contents failed to get contents from 'http://3.93.175.1/api/abfrage/' (400): Bad Request
Details:
DataSourceKind=Web
DataSourcePath=http://3.93.175.1/api/abfrage
Url=http://3.93.175.1/api/abfrage/
我的查詢如下:
let
Source = Json.Document(Web.Contents("http://3.93.175.1/api/abfrage/", [Headers=[#"Content-Type"="application/json", Authorization="Token d04b033d7fa9760147aa32743284ace16de2bbd0"], Content=Json.FromValue({[number_of_requests=1, search_term="Transalb"]})]))
in
Source
如果您想親自檢查,令牌是有效的。
我不明白的是,我在使用這個在線 API 測驗工具時得到了正確的回應:
POST /api/abfrage/ HTTP/1.1
Host: 3.93.175.1
Authorization: Token d04b033d7fa9760147aa32743284ace16de2bbd0
Content-Type: application/json
Content-Length: 52
{"number_of_requests":"1",
"search_term":"Transalb"}
奇跡般有效:
Server: nginx/1.21.6
Date: Sat, 28 May 2022 03:55:51 GMT
Content-Type: application/json
Content-Length: 48708
Connection: keep-alive
Vary: Accept
Allow: GET, POST, HEAD, OPTIONS
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
{"Jahresabschluss zum Gesch\u00e4ftsjahr vom 01.01.2020 bis zum 31.12.2020": {"date": "2022-03-09T00:00:00", "name": "Jahresabschluss zum Gesch\u00e4ftsjahr vom 01.01.2020 bis zum 31.12.2020", "company": "Transalb K\u00fchl- und Express-GmbH", "report": "<!DOCTYPE html>\n<html lang=\"de\" data-signedin=\"nein\" data-siteid=\"3\">\n<head><script type=\"text/javascript\"}}
希望您能夠幫助我。如果您需要更多資訊,請大聲喊叫。
uj5u.com熱心網友回復:
終于自己搞定了,感謝這篇很棒的帖子:
https://community.powerbi.com/t5/Power-Query/Json-FromValue/td-p/1248394
只需將我的請求更改為以下內容:
let
Source = Json.Document(Web.Contents("http://3.93.175.1/api/abfrage/", [Headers=[Authorization="Token 6bcc8706f68d3635f1514ce22611e83c12b1e4c1", #"Content-Type"="application/json"], Content=Json.FromValue([number_of_requests="1", search_term="Transalb"])]))
in
Source
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/487504.html
標籤:擅长 邮政 力比 http-status-code-400
上一篇:在django中更改影像名稱
