cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI Decoding HTTP when Loading to Model Causing Error 404

When loading data to the model, Power BI is decoding a "%2f" in the URL to a "/", which must be encoded. See below.

 

https://[DOMAIN]/[PATH]%2fuser?[QUERY]

 

I've tried forcing the "/" to be encoded in the M query, which works in the Query Editor using "Uri.EscapeDataString("/").

let
    Encoded = Uri.EscapeDataString("/"),
    Source = Json.Document(Web.Contents("https://[DOMAIN]/[PATH]" & Encoded & "user?[QUERY]", [Headers=[Authorization="[AUTHKEY]"]]))
in
    Source

This is ignored when loading data to model and I'm received (redacted) the "/" decoded, which is causing the 404 Error.

 

OLE DB or ODBC error: [DataSource.Error] Web.Contents failed to get contents from 'https://[DOMAIN]/[PATH]/user?[QUERY]' (404): Not Found.

 

Unfortunately, the API I'm working with requires this section of the URL to be encoded (I've tested this outside of PBI). I'm able to view and model the data unimpeded in the query editor, but the encoding during the model loading is causing an Error 404. 

The forum were very helpful, but nothing apart from a custom Python CSV export is a viable workaround.

Status: New
Comments
Moderator

Hi @seann,

 

Would you please share a pbix file so we can reproduce the issue with it on our side? 

 

Best Regards,
Qiuyun Yu 

Frequent Visitor

Thanks @v-qiuyu-msft. For privacy/secuirty reasons, I can't share the pbix unfortunately.

 

To reproduce the bug, just use a blank query and the following M for any API of a similar fornat (we using Realm's graphql API). The bug is that all characters prior to a "?" in a http request are decoded when loading to model.

 

 

let
    Encoded = Uri.EscapeDataString("/"),
    Source = Json.Document(Web.Contents("https://[DOMAIN]/[PATH]" & Encoded & "[PATH2]?[QUERY]", [Headers=[Authorization="[AUTHKEY]"]]))
in
    Source