Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello, I'm trying to obtain a Winfra 3 API token from Power BI (Power Query M). In Postman, the POST request to http://185.253.153.45/winfra3/api_token/ returns the token in JSON without issue. In Power BI:
The call using Web.Contents appears to execute, but Binary.Length(response) returns -1.
If I try to read the content, I receive conversion errors (Binary → Text).
I suspect the server is returning compressed JSON without the Content-Encoding header, or that Power BI is blocking the body due to Web.Contents policies when using a direct IP address.
Results:
In Postman: Readable JSON { "token": "xxxxx", ... }.
In Power BI: len = -1 and if Power BI tries to preview the response, it displays "We cannot convert a value of type Binary to type Text".
What I've already tried:
Forcing Accept-Encoding = "identity".
Sending host + RelativePath (not yet finalized).
Attempts at Binary.Decompress(response, Compression.GZip) and Compression.Deflate (unsuccessful because Power BI doesn't return a body).
Specific question: Has anyone managed to consume the Winfra API from Power BI? What tricks did you use (proxy, RelativePath, specific headers, gateway, enterprise gateway, or changing User-Agent)? Any experience with servers that deliver compressed responses without Content-Encoding and how did you handle it in Power Query?
Thanks.
Thankyou, @DataVitalizer for your response.
Hi raquelm,
We appreciate your inquiry through the Microsoft Fabric Community Forum.
We would like to inquire whether have you got the chance to check the solution provided by @DataVitalizer to resolve the issue. We hope the information provided helps to clear the query. Should you have any further queries, kindly feel free to contact the Microsoft Fabric community.
Thank you.
Hi @raquelm
You’re right, Power BI shows Binary.Length = -1 when the server sends compressed JSON without a proper Content‑Encoding header.
The fix is to force plain JSON and then parse it manually, here is an exxample:
let
url = "http://185.253.153.45/winfra3/api_token/",
body = "{""username"":""yourUser"",""password"":""yourPass""}",
response = Web.Contents(
url,
[
Content = Text.ToBinary(body),
Headers = [
#"Content-Type" = "application/json",
#"Accept" = "application/json",
#"Accept-Encoding" = "identity",
#"User-Agent" = "PowerQuery"
]
]
),
asJson = Json.Document(Text.FromBinary(response, TextEncoding.Utf8))
in
asJson
The key trick is to add Accept-Encoding = identity so the server returns uncompressed JSON, then wrap with Text.FromBinary to Json.Document.
Did it work? 👍 A kudos would be appreciated
🟨 Mark it as a solution to help spread knowledge 💡
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.