Forum Discussion
Why is %29 in a URL Encode to ) During a Request?
- 1 year ago
Hi Suraj_Ncircle
While encoding the entire URL using Uri.EscapeDataString in PQ is problematic because Web.Contents expects a valid absolute URL and may not properly handle fully encoded URLs.
However, we can work around this by constructing the request in a way that ensures encoding remains intact.
Manually encoding the entire URL:
***************************************************************
let
BaseUrl = "https://cdn.Domain.com/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlO_dmVyc2lvbj0x/output/Resource/3D%20View/2_%2...",
Cookies = "your_cookie_data",
EncodedUrl = Uri.EscapeDataString(BaseUrl), // Encode the entire URL
QueryResponse = Web.Contents(EncodedUrl & Cookies, [Headers=[#"Accept"="application/json"]])
in
QueryResponse
***************************************************************
After giving a try if still the issue persists. Could you please follow below link to raise a support ticket
https://learn.microsoft.com/en-us/power-bi/support/create-support-ticketIf the above information helps you, please give us a Kudos and marked the reply Accept as a Solution.
Thanks,
Cheri Srikanth
Hi Suraj_Ncircle
Could you please review the updated code below to see if it meets your requirements?
*************************************************
let
OriginalUrl = "https://cdn.Domain.com/...",
EncodedUrl = Binary.ToText(Text.ToBinary(OriginalUrl), BinaryEncoding.Base64),
QueryResponse = Web.Contents("https://yourproxyserver.com", [Query = [encodedUrl = EncodedUrl]])
in
QueryResponse
*************************************************
If the above information helps you, please give us a Kudos and marked the reply Accept as a Solution.
Thanks,
Cheri Srikanth
- Suraj_Ncircle1 year agoFrequent Visitor
Unfortunately, the suggested solution didn’t work for me. The request is still not returning the expected response. The encoding used by Web.Contents differs from what the server expects, and due to re-encoding, some parts of the URL do not match the original one. I would appreciate any further guidance or alternative approaches to resolve this issue.
Additionally, why does Web.Contents re-encode an already encoded URL?
- v-csrikanth1 year agoCommunity Support
Hi Suraj_Ncircle
While encoding the entire URL using Uri.EscapeDataString in PQ is problematic because Web.Contents expects a valid absolute URL and may not properly handle fully encoded URLs.
However, we can work around this by constructing the request in a way that ensures encoding remains intact.
Manually encoding the entire URL:
***************************************************************
let
BaseUrl = "https://cdn.Domain.com/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlO_dmVyc2lvbj0x/output/Resource/3D%20View/2_%2...",
Cookies = "your_cookie_data",
EncodedUrl = Uri.EscapeDataString(BaseUrl), // Encode the entire URL
QueryResponse = Web.Contents(EncodedUrl & Cookies, [Headers=[#"Accept"="application/json"]])
in
QueryResponse
***************************************************************
After giving a try if still the issue persists. Could you please follow below link to raise a support ticket
https://learn.microsoft.com/en-us/power-bi/support/create-support-ticketIf the above information helps you, please give us a Kudos and marked the reply Accept as a Solution.
Thanks,
Cheri Srikanth