Forum Discussion
Power BI Service Trims Trailing Slash in Web.Contents Base URL – Causes API Error (LeafLink)
- 1 year ago
Hi DataIkseer
The Root Cause
Power BI Service treats
Web.Contentsdifferently — particularly in how it constructs and evaluates the base URL and relative paths. One specific behavior is that:-
Trailing slashes in the base URL can be trimmed or misinterpreted when used directly in
Web.Contents, especially if you're using query parameters or dynamic URL construction.
This is more likely to cause issues if:
-
The API requires an exact match of the endpoint structure, including trailing slashes.
You're using the
Web.Contentsoverload that splits base URL and query, and the service tries to "optimize" or pre-evaluate URLs for gateway compatibility.Recommended Fix
Use the fully constructed URL (with query parameters) as a single string to avoid Power BI Service manipulating the structure.
Here's how to rework your
fetchPagefunction safely:
fetchPage = (offset as number) =>
let
fullUrl = baseUrl & "?" & Uri.BuildQueryString([
limit = Number.ToText(limit),
offset = Number.ToText(offset)
]),
Source = Web.Contents(
fullUrl,
[
Headers = [
#"Authorization" = "Token " & token,
#"Content-Type" = "application/json"
]
]
),
JsonResponse = Json.Document(Source)
in
JsonResponseMicrosoft Documentation Note
This quirk isn't very well-documented, but it's been raised in several forums and GitHub issues, especially around:
-
Relative path handling
-
Base URL and privacy levels
-
URL encoding and trailing slash behavior
So yes — it's expected behavior but under-documented. You’re not doing anything wrong; this is a subtle platform inconsistency between Desktop and Service.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
-
Hi DataIkseer ,
We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
|
Please don't forget to give a "Kudos " – I’d truly appreciate it! |
Regards,
B Manikanteswara Reddy
Hi DataIkseer ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
|
Please don't forget to give a "Kudos " – I’d truly appreciate it! |
Regards,
B Manikanteswara Reddy
- Anonymous1 year agoNot applicable
Hi DataIkseer ,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Please don't forget to give a "Kudos " – I’d truly appreciate it!
Regards,
B Manikanteswara Reddy