Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Retrieving and parsing existing Entitlement values in REST connector

Regular Contributor II
Regular Contributor II


We have an application where there is no Add/Remove API to update the entitlements for an user. Instead we need to call update API and send the existing entitlements and new entitlement as an array to add new entitlements. Now I understand that we need 2 calls, one to retrieve the Roles and the 2nd one to pass the array.

The first API response is as below to get one specific user details. The response does not have any name for the result.

    "roles": [
        1, 2
I found below snippet from the connector guide but i want to know how to iterate through the array of roles in the first response above. Also what will be in my case?
"httpParams": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><user><roles>${String rolesStr = '';int size = response.Role1.message.roles?.size();int i = 0;for (Map map : response.Role1.message.roles){if(!{rolesStr=rolesStr+'<role><name>''</name></role>';i++;if(i == size){return rolesStr;}}else{i++;if(i == size){return rolesStr;}}}}</roles></user>"

Saviynt Employee
Saviynt Employee

You can refer the below article for this requirement.