How to escape the "$" character in a URL

Hello,

I have a problem with the “$” character in the URL for the “Get Object” operation in the Webservice connector
Here’s the URL I have to use (OData syntax) :

/v1/Users?$filter=(id eq $getobject.nativeIdentity$)&$select=userLogin,name,id&$expand=roleStaticUsers($select=rolesId)

It happens that IDN automatically interprets the characters between two “$” symbols, so it interprets this part $filter=(id eq $ as if it is a variable.
To avoid this behavior I have to escape the “$” symbols that are not variables.
I’ve tried encoding the “$” with “%24” but this doesn’t solve the problem.

I’d like to leave the Before Rule as a last resort in case there’s no way to escape.

Thanks in advance for your help!

What have you tried so far?

Assuming that section uses the Apache Velocity Template engine also, you could try some of the suggestions from this Stack Overflow question: java - Escaping the dollar sign in velocity using backslash not working - Stack Overflow

The Unparsed Content section here may be helpful. Apache Velocity Engine VTL Reference

I don’t have a system set up currently to test this with.

1 Like

Hi @Haytam

You could create a static variable with the value “$” assigned to it and assign this to an Identity Attribute with a transform like below and then reference this variable in your URL:

{
                "attributes": {
                    "value": "#set($d = '$')$d"
                },
                "type": "static"
            }

Hello Geoff

Thanks for the suggestions. Unfortunately it’s one of the things I’ve already tested but that didn’t solve the problem: it seems that the URL is not interpreted with Apache Velocity Template, I see in the logs literally what is entered in the URL field.
Only stuff between two “$” symbols is translated.

Hello Irshaad,

Thanks for the suggestion. I find that this proposal (even if it would work) will complicate the implementation and I would prefer SailPoint to provide us with a simpler solution.
Otherwise, I’ll opt for the Before Operation Rule.

Have you tried a backslash like this:

/v1/Users?\$filter=(id eq $getobject.nativeIdentity$)&\$select=userLogin,name,id&\$expand=roleStaticUsers(\$select=rolesId)

Hello Ivan,

Thank you for your suggestion. Yes I tested with backslash too but still have the same problem with URL interpretation.

Hi @HaytamDid you try to encode all special characters?

/v1/Users?$filter=%28id%20eq%20%24getobject.nativeIdentity%24%29&$select=userLogin,name,id&$expand=roleStaticUsers(%24select=rolesId%24)

@Haytam here is what you have to use ‘$getobject.nativeIdentity$’

So your query will look like below:

/v1/Users?$filter=(id eq ‘$getobject.nativeIdentity$’)&$select=userLogin,name,id&$expand=roleStaticUsers($select=rolesId)

Or you can also get it from plan


/v1/Users?$filter=(id eq ‘$plan.nativeIdentity$’)&$select=userLogin,name,id&$expand=roleStaticUsers($select=rolesId)

If above does not work try without brackets “)(“


/v1/Users?$filter=id eq ‘$getobject.nativeIdentity$’&$select=userLogin,name,id&$expand=roleStaticUsers($select=rolesId)

Or

/v1/Users?$filter=id eq ‘$plan.nativeIdentity$’&$select=userLogin,name,id&$expand=roleStaticUsers($select=rolesId)

Below query works for me sharing for your reference


###For single account aggregation###

#Get user details (parent endpoint) map the userId (which is personIdExternal)
/odata/v2/User('$plan.nativeIdentity$')?$select=defaultFullName,status,department&$expand=empInfo,pronounsNav/picklistLabels&$filter=status in 'active'&$format=json

#Get EmpJob details (child endpoint) fetch the response like below
/odata/v2/EmpJob?$select=company,companyNav/name_defaultValue&$filter=userNav/empInfo/personIdExternal eq '$response.userId$'&$expand=departmentNav,locationNav,companyNav,customString2Nav,userNav,userNav/empInfo&$format=json

Finally, I managed to get it to work using the following:

/v1/Users?%24filter=(id eq $getobject.nativeIdentity$)&%24select=userLogin,id&%24expand=roleStaticUsers(%24select=rolesId)

Only the “$” that are not part of the variable should be encoded
The “$” symbols that are part of placeholders must remain unencoded
I think there was a mistake in the first tests I did.

Thank you all for your suggestions!

2 Likes

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