Legacy Dev Forum Posts

 View Only

Sign Up

Calling API with space url

  • 1.  Calling API with space url

    Posted 06-05-2025 18:43

    SeowLengNg | 2022-07-06 08:16:43 UTC | #1

    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"?


    Jerome.Saint-Marc | 2022-07-06 08:32:50 UTC | #2

    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,


    SeowLengNg | 2022-07-07 07:52:38 UTC | #3

    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!


    SeowLengNg | 2022-07-07 09:50:12 UTC | #4

    Hi,

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

    I have solved my problem. Thanks!


    Jason_Mathison | 2022-07-07 09:58:51 UTC | #5

    It should be possible to use the $esc.url($input) macro to take care URL escaping as documented on this page: https://help.mypurecloud.com/articles/velocity-macros-data-actions/

    --Jason


    SeowLengNg | 2022-07-07 10:13:19 UTC | #6

    Hi Jason,

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

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

    Thanks!


    Jason_Mathison | 2022-07-11 02:56:34 UTC | #7

    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


    system | 2022-08-11 02:57:18 UTC | #8

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


    This post was migrated from the old Developer Forum.

    ref: 15398