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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Richard_W
Frequent Visitor

Web.Contents unencoding forward slahes

Hi,

 

I'm trying to call the Google Search Console API which requires the following format:

 

GET https://www.googleapis.com/webmasters/v3/sites/siteUrl/urlCrawlErrorsCounts/query

Where siteUrl is an encoded URL of the format:

 

https%3A%2F%2Fwww.example.com

 

However when I put that in to the Web.Contents function it always unencodes the forward slashes meaning I can never reach the Google endpoint.

 

Example:

CfceSgI

 

 

 

 

 

 

 

 

 

I have used the Uri.EscapeDataString() function but Web.Contents just undoes the encoding.

 

How do I tell the function not to unencode the string?

 

Thanks,

Richard

6 REPLIES 6
jaryszek
Post Patron
Post Patron

Guys,

 

there is no solution for this. Where can i report a bug for Microsoft? 

jaryszek
Post Patron
Post Patron

Anybody find solution? 

jaryszek
Post Patron
Post Patron

Hi Guys,

 

i have the same issue and want to up this topic. This is basic stuff with this url encoding, it is possible with web contents function at all?

 

Please help,
Jacek

v-huizhn-msft
Employee
Employee

Hi @Richard_W,

You can ask for help from Google Support  to get how to use Google Search Console API to retrieve data. Then use "Get Data->Web" entry in Power BI Desktop or directly add connection information in Advanced Editor to connect to your API. There are some samples for your reference.

API Strategies with Power BI
Get Data from Twitter API with Power Query

how to connect my web api wtih Power BI Reports?

Regards,
Angelia

Hi @v-huizhn-msft,

 

Thanks for your response, however I can't seem to find any reference to people trying to encode a '/' in Web.Contents.

 

I firmly believe this is a problem with the Web.Contents function and for some reason it is unencoding any '%2F' into a '/' even though I don't want it to.

 

Example power query:-

 

let
    URL = "https://www.example.com/en-gb",
    Encode = Uri.EscapeDataString(URL),
    Source = Web.Contents("https://dataapi.com/site/" & Encode & "/dataEndpoint"),
in
    Source

The expected result from this power query should be:-

 

https://dataapi.com/site/https%3A%2F%2Fwww.example.com%2Fen-gb/dataEndpoint

 

But instead the actual call from Web.Contents is to:-

 

https://dataapi.com/site/https%3A//www.example.com/en-gb/dataEndpoint

 

Which is wrong!

 

How can I force Web.Contents to keep the '%2F' encoded and not to unencode it to a '/'?

 

Thanks,

Richard

I've used fiddler to see what URL is going out from Power BI and can confirm that it is unencoding the '%2F' to a '/'.

 

Any idea what I can do to stop this?

 

Thanks,

Richard

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.