Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I am trying to use Power Query in Power BI for a POST request, and I am getting this (415) unsupported media type error. The content has been tested in Postman (an API tester). Any help is 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 xxxxxx"], Content=Text.ToBinary(content)]))
in
Source
Assuming you meant 415, unsupported media type and not 414, URI too long.
Definitely does not like your headers. Maybe play with some of the optional parameters for ToBinary?
https://docs.microsoft.com/en-us/powerquery-m/text-tobinary
@ImkeF @edhans you guys do much with stuff like this? Is that endpoint really expecting that in binary?
sorry that was a typo, fixed it.
that Text.ToBinary() is something I copied from other threads. If I remove it and just pass the JSON body to Content, it gives another error.
Yes @Anonymous ,
my bad - your original syntax looks alright. Content has to be a binary value.
Just re-check the error message and if nothing different comes up that can give a hint you should use Fiddler to compare the commands that both tools send.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Sorry, I don't have much experience about this particular topic. 😐
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingHi
that's just a bracket at the wrong position. Try this:
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 xxxxxx", Content=Text.ToBinary(content)]]))
in
Source
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi Imke,
thanks a lot for the answer.
But after changing to your way, I got a different error:
Expression.Error: We cannot convert a value of type Binary to type Text.
Details:
Value=[Binary]
Type=[Type]
which I think makes sense because, in your solution content is included in the header section. But content should be in the body of a POST request. Any thoughts?
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.