Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I created a function to do paginated API calls, but the output is containing %20 instead of a space, which the endpoint is not accepting.
getProjectURIpaginatedX
(projectNo as text, objectType as text, attrList as text, topVal as number, skipVal as number)=>
let
GetWebContents =
Web.Contents(
"https://api-us.drofus.com/api/company/",
[
RelativePath= Text.Replace(
projectNo
& "/" & objectType
& "?$select=" & attrList
& "&$top=" & Number.ToText(topVal)
& "&$skip=" & Number.ToText(skipVal),
"%20", " ")
]
),
GetBody = Json.Document(GetWebContents)
in
GetBody
I tried inserting a Text.Replace on the RelativePath, but I still get a 400 HTTP error.
Thank you for any advice!
Solved! Go to Solution.
The 400 http error was not due to the %20 but due to a trailing comma and space in the AttrList column.
My apologies.
The 400 http error was not due to the %20 but due to a trailing comma and space in the AttrList column.
My apologies.
Here is the query that is calling the function:
The column AttrList was generated with grouping Lines.ToText.
= Table.Group(#"01addNdxGroup", {"ndxGroup"}, {{"attr", each Lines.ToText(List.Sort(List.Distinct([dRofus.ID])), ", "), type text}})
User | Count |
---|---|
15 | |
4 | |
2 | |
1 | |
1 |
User | Count |
---|---|
21 | |
3 | |
2 | |
2 | |
2 |