Calling API with space url

Hi,

i'm hitting following error when calling a data action with URL below:

{{url}}/api/v1/users?search=profile.eid eq "1511915"

  • Failed due to malformed requestUrlTemplate. Illegal character in query at index 66: {{url}}/api/v1/users?search=profile.eid eq "1511915"

Can you please advise how should i configure the URL in "configuration"?

Hello,

Some characters need to be escaped in a url - like the space character.
That's what your internet browser does when you type such a url - it will escape necessary characters before issuing the request.

So you'd need to escape the space character (%20), and possibly the quotes (%27).
See this other post with my answer

It means your url will need to be set to:

{{url}}/api/v1/users?search=profile.eid%20eq%20%27${input.employeeNumber}%27

Regards,

Hi,

I still hitting error "Invalid search criteria."

{{url}}/api/v1/users?search=profile.eid eq "1511915"

Can you please advise what is double quote for escape characters?

i tried this, but still not correct:

{{url}}/api/v1/users?search=profile.eid%20eq%20%22${input.EmployeeNumber}%22

thanks!

Hi,

Please ignore my previous question. %22 is for double quote.

I have solved my problem. Thanks!

It should be possible to use the $esc.url($input) macro to take care URL escaping as documented on this page:

--Jason

Hi Jason,

Can you please advise how should i configure for this URL?

{{url}}/api/v1/users?search=profile.eid eq "1511915"

Thanks!

This seemed to work for me:
{{url}}/api/v1/users?search=$esc.url("profile.eid eq ${esc.quote}1511915${esc.quote}")

${esc.quote} avoids any quote escaping, and allows it to be next to the 1511915. This also takes care of space escaping.

--Jason

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.