Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello, I am trying to connect my POST method for a REST API from planful with a blank query in PQuery. I use the query (replacing endpoint, user and password):
let
url = "https://xxxxx",
body = Text.ToBinary("{ ""Scenario"": ""Actual"", ""FiscalYear"": 2024, ""FiscalMonth"": 6, ""top"": 100 }"),
headers = [
#"Content-Type" = "application/json",
Authorization = "Basic " & Binary.ToText(Text.ToBinary("user:password"), BinaryEncoding.Base64)
],
response = Web.Contents(url, [
Content = body,
Headers = headers,
ManualStatusHandling = {400, 404, 405}
]),
jsonResponse = Json.Document(response)
in
jsonResponsebut I reveive always this error (compared in postman and working correctly):
DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.
Details:
DataSourceKind=Web
DataSourcePath=https://xxxxxx
If I connect with the "Get Data" button selecting WEB, another API with Planful but GET Method and it works perfectly with the prompt window and then selecting Basic. But if I try the Post method I will receive this error:
Details: "Web.Contents failed to get contents from 'https://xxxxx' (405): Method Not Allowed"
Any help to get the data with post method? I've been trying a lot of things, chat gpt, but nothing seems to work.
Thanks in advance
Solved! Go to Solution.
Thanks for the response, but I've been trying with those codes in PQuery, but the problem mentioned in the post appear when I try to use Basic Auth in that Post method. What I've been reading is that PBI is selecting GET as default method and something Crash when you try to add Basic Auth in Post method. My current solution is using a Python script, test it in visual studio, and if that gives me the data I need, the Get Data source in PBI will be Python Scipt. that runs correctly, the only thing is that user and pswrd will be in the code, so you can create env variables in your pc or server, and avoid write them in the script. I will select this as solution in case after some more hours anyone have any other solution.
Thanks 😁
Thanks for the response, but I've been trying with those codes in PQuery, but the problem mentioned in the post appear when I try to use Basic Auth in that Post method. What I've been reading is that PBI is selecting GET as default method and something Crash when you try to add Basic Auth in Post method. My current solution is using a Python script, test it in visual studio, and if that gives me the data I need, the Get Data source in PBI will be Python Scipt. that runs correctly, the only thing is that user and pswrd will be in the code, so you can create env variables in your pc or server, and avoid write them in the script. I will select this as solution in case after some more hours anyone have any other solution.
Thanks 😁
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 43 | |
| 39 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 63 | |
| 32 | |
| 30 | |
| 23 |