The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a power query like this, and it gives me this 400 bad request error when I try to exec it. Any help would be appreciated.
let
content = "{
""spec"": {
""ids"": [""0001""],
""interval"":""HOUR"",
""expressions"": [
""CompoundChilledWaterConsumptionForecast""
],
""start"": ""2020-01-01T00:00:00.000"",
""end"": ""2020-01-02T09:00:00.000"",
""include"": ""start, end, interval, count, dates, data, timeZone, unit""
}
}",
Source = Json.Document(Web.Contents("https://engie-osep.c3iot.com/api/1/engie-osep/prod/Facility?action=evalMetrics", [Headers=[#"Authorization"="Basic xxxxxxx"]]))
in
Source
Solved! Go to Solution.
Hi @Anonymous ,
It seems you want to post a request, we need to ues Contens record in Web.Contents as following:
let
ContentBody = "{
""spec"": {
""ids"": [""0001""],
""interval"":""HOUR"",
""expressions"": [
""CompoundChilledWaterConsumptionForecast""
],
""start"": ""2020-01-01T00:00:00.000"",
""end"": ""2020-01-02T09:00:00.000"",
""include"": ""start, end, interval, count, dates, data, timeZone, unit""
}
}",
Source = Json.Document(Web.Contents("https://URL/api/1/engie-osep/prod/Facility?action=evalMetrics", [Headers=[#"Authorization"="Basic xxxxxxx"], Contens=ContentBody]))
in
Source
Please refer to following document about Web.Contents function:
https://docs.microsoft.com/en-us/powerquery-m/web-contents
Best regards,
Hi @Anonymous ,
It seems you want to post a request, we need to ues Contens record in Web.Contents as following:
let
ContentBody = "{
""spec"": {
""ids"": [""0001""],
""interval"":""HOUR"",
""expressions"": [
""CompoundChilledWaterConsumptionForecast""
],
""start"": ""2020-01-01T00:00:00.000"",
""end"": ""2020-01-02T09:00:00.000"",
""include"": ""start, end, interval, count, dates, data, timeZone, unit""
}
}",
Source = Json.Document(Web.Contents("https://URL/api/1/engie-osep/prod/Facility?action=evalMetrics", [Headers=[#"Authorization"="Basic xxxxxxx"], Contens=ContentBody]))
in
Source
Please refer to following document about Web.Contents function:
https://docs.microsoft.com/en-us/powerquery-m/web-contents
Best regards,
Well,
The 400 Bad Request error is an HTTP status code that means that the request you sent to the website server, often something simple like a request to load a web page, was somehow incorrect or corrupted and the server couldn't understand it.
I imagine it has something to do with the Headers you are sending.