Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

(415) Unsupported media type error when using Power Query for POST request

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

 

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

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?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

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.

ImkeF
Community Champion
Community Champion

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. 😐



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Hi

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

Anonymous
Not applicable

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?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors