Split entitlement value and send in REST URL

RV
Regular Contributor
Regular Contributor

Can someone please provide a syntax to split an entitlement value by Tilde and send the first token it in a REST URL.

Entitlement Value : IGA~admin

Instead of sending the entire entitlementValue, I need to pass only "IGA" by splitting the string by ~ and sending the first token.

{

      "name": "Team",

      "connection": "acctAuth",

      "url": https://api.github.com/orgs/${entitlementValue}/memberships/${account.name},

2 REPLIES 2

Hemanath
Saviynt Employee
Saviynt Employee

@RV 

Try with below one

"https://api.github.com/orgs/${String ev=entitlementValue;String[] evArray=ev.split(\"~\");return java.net.URLEncoder.encode(evArray[0],java.nio.charset.StandardCharsets.UTF_8.toString())}/memberships/${account.name}"

Thanks,

Hemanath J

If this reply answered your question, please Accept it As Solution to help others who may have a similar problem.

adriencosson
Regular Contributor III
Regular Contributor III

Hi @RV ,

You can try the below sample :

${entitlementValue.entitlement_value.substring(0,entitlementValue.entitlement_value.indexOf('~'))}

Hope this helps !

Regards,
Adrien COSSON