The Saviynt REST connector supports Looping operations. Refer following article/example to understand how it can be configured.
Pre-requisites
Rest Connection
Applicable Version(s)
All
In the REST connector provisioning JSONs, javascript operations such as ternary conditions, FOR loop, and string operations are applied on attribute values as per requirement. For example, “Roles”: [${response.call1.message.roles.toString().replace(‘[’,’’).replace(‘]’,’’).replace(‘,’,’\”,\”’)}]
1. Example for JSON with ternary conditions:
2. Example for JSON with string operations:
{
"name":"call1",
"connection":"userAuth",
"url":"${requestAccessAttributes.addRemoveAlias==null?'https://<domain name>/admin/directory/v1/users/'+account.name:account.customproperty30.toString().contains(requestAccessAttributes.addRemoveAlias)?'https://<domain name>/admin/directory/v1/users/'+account.name+'/aliases/'+requestAccessAttributes.addRemoveAlias.trim():'https://<domain name>/admin/directory/v1/users/'+account.name+'/aliases'}",
"httpMethod":"${requestAccessAttributes.addRemoveAlias==null?'PUT':account.customproperty30.toString().contains(requestAccessAttributes.addRemoveAlias)?'DELETE':'POST'}",
"httpParams":"${requestAccessAttributes.addRemoveAlias==null?'{\"name\":{\"familyName\":\"'+user.firstname+'\",\"givenName\":\"'+user.lastname+'\"},\"password\":\"password\",\"primaryEmail\":\"'+account.name+'\",\"orgUnitPath\":\"/\"}':account.customproperty30.toString().contains(requestAccessAttributes.addRemoveAlias)?'{}':'{\"alias\": [\"'+requestAccessAttributes.addRemoveAlias.trim()+'\"]}'}",
"httpHeaders":{
"Authorization":"${access_token}",
"Content-Type":"application/json"
},
"httpContentType":"application/json",
"successResponses":{
"statusCode":[
200,
201,
2014
]
}
}
3. Example for JSON with FOR Loop:
{
"call":[
{
"name":"Group",
"connection":"userAuth",
"url":"https://<domain name>/sys_user_grmember?user=${account.accountID}",
"httpMethod":"GET",
"httpHeaders":{
"Authorization":"${access_token}"
},
"httpContentType":"application/json",
"successResponses":{
"statusCode":[
200
]
},
"unsuccessResponses":{
"statusCode":[
400
]
}
},
{
"name":"Group",
"connection":"userAuth",
"url":"https://<domain name>/sys_user_grmember/${for (Map map : response.Group1.message.result){if (map.group.value.toString().equals(entitlementValue.entitlementID)){return map.sys_id;}}}",
"httpMethod":"DELETE",
"httpHeaders":{
"Authorization":"${access_token}"
},
"httpContentType":"application/json",
"successResponses":{
"statusCode":[
204
]
},
"unsuccessResponses":{
"statusCode":[
400
]
}
}
]
}