Lloyd | 2022-03-28 23:13:15 UTC | #1
Performing a look-up or Users from Alemba ASM. I can successfully request the OAuth token and make a general request for All Users But request fails when I add the URL parameters for filtering
Testing API Endpoint works for All Users:
https://development--server-fqdn.com/dev/alemba.api/api/v1/user?${esc.dollar}select=PersonnelReference,FirstName,Surname,Name,EmailAddress,Telephone,Mobile&${esc.dollar}inlinecount=true
Which resolves to
"[GET] https://development--server-fqdn.com/dev/alemba.api/api/v1/user?$select=PersonnelReference,FirstName,Surname,Name,EmailAddress,Telephone,Mobile&$inlinecount=true"
This works correctly, and all the user records are returned successfully
I can successfully append my search filter to the request in Postman, so I know the endpoint parameters are correct
As working in Postman:
https://development--server-fqdn.com/dev/alemba.api/api/v1/user?$select=PersonnelReference,FirstName,Surname,Name,EmailAddress,Telephone,Mobile&$inlinecount=true&$filter=Mobile="021770256"
But when I add the filter to my requestUrlTemplate in the Data Action:
https://development--server-fqdn.com/dev/alemba.api/api/v1/user?${esc.dollar}select=PersonnelReference,FirstName,Surname,Name,EmailAddress,Telephone,Mobile&${esc.dollar}inlinecount=true&${esc.dollar}Mobile=${esc.quote}021770256${esc.quote}
The request fails with the following error
Failed due to malformed requestUrlTemplate. Illegal character in query at index 170:
https://development--server-fqdn.com/dev/alemba.api/api/v1/user?$select=PersonnelReference,FirstName,Surname,Name,EmailAddress,Telephone,Mobile&$inlinecount=true&$Mobile="021770256"
When I trace it out, character 170 is the = after the word Mobile
I've validated this by moving the parameter sequence around, and the error allows refers to this equals
- If I remove the quotes around the 021770256 then the request is successful, but the receiving API basically ignores it and returns all data
- I have tried substituting eq instead of = like we do with Salesforce, however the Alemba API rejects this
- I've even tried changing the capital M to a lowercase m on mobile, but the Alemba API rejects this
So looking for pointers on what I'm assuming is the obvious that I've missed? (please)
- Is filter a keyword that needs escaping somehow
- Can I escape the equals somehow
- ???
- Or worst case a method to filter the returned array data based on a input value
Thanks
Greg_Cunningham | 2022-03-30 13:31:29 UTC | #2
What is needed is to escape the URL with the $esc.url() tool.
Using the $esc.url macro appears to works in our tests.
https://development--server-fqdn.com/dev/alemba.api/api/v1/user${esc.url("${esc.dollar}select=PersonnelReference,FirstName,Surname,Name,EmailAddress,Telephone,Mobile&${esc.dollar}inlinecount=true&${esc.dollar}Mobile=${esc.quote}021770256${esc.quote}")}
That resolves to
[GET] https://development--server-fqdn.com/dev/alemba.api/api/v1/user%24select%3DPersonnelReference%2CFirstName%2CSurname%2CName%2CEmailAddress%2CTelephone%2CMobile%26%24inlinecount%3Dtrue%26%24Mobile%3D%22021770256%22
system | 2022-04-30 13:32:11 UTC | #3
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: 14059