Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

URL encode for entitlementValue.entitlement_value

mayankshah
New Contributor III
New Contributor III

Q) How to encode the URL dynamically as the entitlement_value could be of multiple ' ' (spaces) and different special character?

Problem: Saviynt is not able to parse the URL and throws : java.net.URISyntaxException error.

"url": "http://xxxxxxxxxxxxx?userid=${account.name}&groupname=${entitlementValue.entitlement_value}&_format=..."

Note: You cannot pass entitlementID (Unique entitlement id/group id) to URL.

Any suggestions will be appreciated.

Thanks

13 REPLIES 13

Darshanjain
Saviynt Employee
Saviynt Employee

For multiple spaces you can use double invited commas in the url like below

"url": "http://xxxxxxxxxxxxx?userid=${account.name}&groupname="${entitlementValue.entitlement_value}"&_forma..."

 Generally we recommend to use entitlement id or any other field which is unique.

mayankshah
New Contributor III
New Contributor III

 

You can use below encoder function to encode spaces and all special characters.

url": "http://xxxxxxxxx?userid=${account.name}&groupname=${URLEncoder.encode(entitlementValue.entitlement_v..., \"UTF-8\").replace(\"+\", \"%20\")}"

Darshanjain
Saviynt Employee
Saviynt Employee

@mayankshah Thanks for updating the solution

IAM_99
Regular Contributor II
Regular Contributor II

Hi @mayankshah @Darshanjain 

I am trying above mentioned solution but  its not working , please let me know any corrections/inputs , we are using this URL  https://xxxxxxx.aha.io/api/v1/products/${URLEncoder.encode(entitlementValue.entitlementID, \"UTF-8\").replace(\"+\", \"%20\")}

 

Caused by: java.net.URISyntaxException: Illegal character in path at index 40: https://xxxxxxx.aha.io/api/v1/products/${URLEncoder.encode(entitlementValue.entitlementID, \"UTF-8\").replace(\"+\", \"%20\")}\u001b[m\n","stream":"stdout","time":"2023-03-31T20:25:28.506808419Z"}

Hi @IAM_99 

Why are you trying to replace characters in EntID as its a numeric value?

Also the Url looks correct , as error is saying index 40 then it looks like when it is starting the double quote. Also if you are able to call this url via postman?

Thanks

Darshan

IAM_99
Regular Contributor II
Regular Contributor II

Hi Darshan

We are calling from Saviynt ( error is from  saviynt logs)

This is the URL https://xxxxxxx.aha.io/api/v1/products/6603028474658293963/users

Product Id ( bolded) /entitltlemtntID has to be passed dynamically when requesting.

 

 

Hi @IAM_99 

Yes , If you are passing the above url in postman is it working fine?

Also if you see the above url you can directly use entitlement why do you need to replace anything as entitlementID is the numeric string. ( its fine that you want to pass it dynamically ) 

 https://xxxxxxx.aha.io/api/v1/products/${entitlementValue.entitlementID}

 

Thanks

Darshan

IAM_99
Regular Contributor II
Regular Contributor II

Yes below works in PSOTMAN -

 https://xxxxxxx.aha.io/api/v1/products/6603028474658293963/users

Same has been converted in Saviynt , each time user selects an entitlement(productid) that value has to be passed in URL so  we are using https://xxxxxxx.aha.io/api/v1/products/${entitlementValue.entitlementID}

Issue start with $ ( it says illegal charector 40 th), its not able to resolve.

${entitlementValue.entitlementID}

Connector screenshot

~~~~~~~~~~~~~~~~~~~~~~~~~~

IAM_99_0-1680531338043.png

 

 

 

 

 

 

Hi @IAM_99 

Make sure you are using flower brackets inside dollar {} . If you still face a issue, would suggest you to raise a Freshdesk ticket so that support team can check the issue fully.

 

Thanks

Darshan

IAM_99
Regular Contributor II
Regular Contributor II

Could you elaborate this - "flower brackets inside dollar {} "

Below is Valid right ? i am using exactly same

https://xxxxxxx.aha.io/api/v1/products/${entitlementValue.entitlementID}/users

Yeah created FD ticket 5 days yet to see a response.

 

Hi @IAM_99 

As checked You were using this in create account json and the binding variables ${entitlementValue.*} is only exposed in add access json. Here the system is calling the create account as account is not present hence it is throwing an error.

 

Only User and account objects are exposed in Create account json , so please create the jsons and modify accordingly as per your use case.
 
 
Thanks
Darshan

IAM_99
Regular Contributor II
Regular Contributor II

Hi Darshan,

We have create Account and Add Access both has same api ( we need to pass entitlementValue).

Below screen is  another REST app which is working with the variable.

 

IAM_99_0-1680614851744.png

 

Hi @IAM_99 

No this is not exposed there may be issue with that app as well , you can check the logs.

It is clear that only user and account objects are exposed in create account. ( if you still differ you can attach the logs of working json with showlogs=true where we can check how it is taking that variable in create account )

 

Thanks

Darshan