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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MarkusEng1998
Resolver II
Resolver II

Json.Document URI contains %20 instead of a space

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.

MarkusEng1998_0-1712248372569.png

 

Thank you for any advice!

1 ACCEPTED SOLUTION
MarkusEng1998
Resolver II
Resolver II

The 400 http error was not due to the %20 but due to a trailing comma and space in the AttrList column.

My apologies.

 

MarkusEng1998_0-1712249407882.png

 

View solution in original post

2 REPLIES 2
MarkusEng1998
Resolver II
Resolver II

The 400 http error was not due to the %20 but due to a trailing comma and space in the AttrList column.

My apologies.

 

MarkusEng1998_0-1712249407882.png

 

MarkusEng1998
Resolver II
Resolver II

Here is the query that is calling the function:

MarkusEng1998_0-1712248480992.png

 

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}})

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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