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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am spending a lot of time trying to get POST's body being actually sent to the server.
API call:
Response = Json.Document(Web.Contents(api_url,
[
Headers = [#"Content-Type"="application/json"],
Content=Text.ToBinary(body)
]
)
)
Body. Code is a bit simplified...
Version 1.
body = "{""client_id"": ""xxxxxx"", ""username"": ""bba85b3d-5121-4439-8f3f-4c1a644bea5f"",
""client_secret"": ""xxxxxxxxxxxxxxxxxxx"", ""grant_type"": ""password""}",
No parameters on the server.
Version 2.
client_id = "xxxxxxx",
username = "bf083798-8751-446e-9c60-6c1cd36ad632",
client_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
grant_type = "password",
body = Text.ToBinary("client_id" & ":" & client_id & ",username" & ":" & username & ",client_secret" & ":" & client_secret & ",grant_type" & ":" & grant_type),
No parameters on the server.
Verion 3.
body = [client_id="xxxxxxx",username="bf083798-8751-446e-9c60-6c1cd36ad632",client_secret="xxxxxxxxxxxxxxxxxxx",grant_type="password"],
Json = Json.FromValue({body}),
Response = Json.Document(Web.Contents(api_url,
[
Headers = [#"Content-Type"="application/json"],
Content=Json
]
)
)
No parameters on the server.
Version 4, the working one.
body = [client_id="xxxxxx",username="bf083798-8751-446e-9c60-6c1cd36ad632",client_secret="xxxxxxxxxxxxxxx",grant_type="password"],
body = Uri.BuildQueryString(body),
Correct parameters appear on the server.
My problem with working version is that it is a QueryString and I am not sure whether it is encrypted or not.
Thanks
Solved! Go to Solution.
Hi @Markzolotoy
I'm not sure what the actual problem is. The title says the POST body isn't working but you've provided an example where it is.
Uri.BuildQueryString does not do encryption. But aren't you then using Text.ToBinary() to encode the output from Uri.BuildQueryString. So it isn't encrypted really, but it is encoded. Your making POST requests not GET so your request isn't providing a 'query string' in the usual sense of HTTP.
What are your privacy concerns? I thought you were working with an internal API?
Regards
Phil
Proud to be a Super User!
Hi @Markzolotoy
I'm not sure what the actual problem is. The title says the POST body isn't working but you've provided an example where it is.
Uri.BuildQueryString does not do encryption. But aren't you then using Text.ToBinary() to encode the output from Uri.BuildQueryString. So it isn't encrypted really, but it is encoded. Your making POST requests not GET so your request isn't providing a 'query string' in the usual sense of HTTP.
What are your privacy concerns? I thought you were working with an internal API?
Regards
Phil
Proud to be a Super User!
Yes, I am working with internal APIs, but once I publish it it will go over the wire. So far as you explained it is still a part of the POST's body, should be ok then.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |