Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/06/2024 01:32 AM
Hi Team -
I have a requirement to use multiple calls in the RemoveAccessJSON.
1st call - Read the current roles
2nd - Remove the entitlement_value from the list and send the updated list
I am using the below JSON which is working fine for add access when the operation is add() and sends the updated list with new entitlement value added. But the same is not working for remove access. I have also attached the logs as seen. in the logs I can see that the API Call made is still including the entitlement value and not being removed
{
"call": [
{
"name": "Role",
"connection": "acctAuth",
"showResponse": true,
"url": "https://***********/api/users?user_ids=${account.accountID}",
"httpMethod": "GET",
"httpHeaders": {
"Accept": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json"
},
{
"name": "Role",
"connection": "acctAuth",
"showResponse": true,
"url": "https://**********/api/users/update_user",
"httpMethod": "POST",
"httpParams": "{\"filters\": {\"user_id\": \"${account.accountID}\"},\"updates\": {\"roles\": [${List responseList = response.Role1.message.data.users.roles.collect { it };responseList.remove(entitlementValue.entitlement_value);return new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(responseList).replace('[','').replace(']','')}],\"email\": \"${user.email}\",\"username\": \"${user.email.substring(0, user.email.indexOf('@'))}\"}}",
"httpHeaders": {
"Accept": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
405,
406,
409,
415,
500
]
}
}
]
}
Thanks
08/06/2024 10:30 AM
Add Callnumber and stageOrder
08/06/2024 10:31 PM
@rushikeshvartak , I have tried that already. that does not make any difference. Also how come the multiple calls in addaccessjson works fine without callnumber and stageorder ?
08/06/2024 10:54 PM
Hi @shivmano can you share the working addAccessJSON?
08/06/2024 10:58 PM
@naveenss , here is the working addAccessJSON
{
"call": [
{
"name": "Role",
"connection": "acctAuth",
"showResponse": true,
"url": "https://******/api/users?user_ids=${account.accountID}",
"httpMethod": "GET",
"httpHeaders": {
"Accept": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json"
},
{
"name": "Role",
"connection": "acctAuth",
"showResponse": true,
"url": "https://***********/api/users/update_user",
"httpMethod": "POST",
"httpParams": "{\"filters\": {\"user_id\": \"${account.accountID}\"},\"updates\": {\"roles\": [${List responseList = response.Role1.message.data.users.roles.collect { it };responseList.add(entitlementValue.entitlement_value);return new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(responseList).replace('[','').replace(']','')}],\"email\": \"${user.email}\",\"username\": \"${user.email.substring(0, user.email.indexOf('@'))}\"}}",
"httpHeaders": {
"Accept": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
405,
406,
409,
415,
500
]
}
}
]
}