and more in a single search tool across platforms. Read the announcement here. |
02/16/2024 08:56 PM
Hello,
For removing group for a user , I need to call update API and pass the existing members of the group after removing the user from the list. I am making 2 calls, 1st to get the group details and 2nd to update the group. Now, even though I am using responseList.remove(account.accountID) in the 2nd call, I can see in the webservice call the accountId is not getting removed from the responselist.
I tried hardcoding responseList.remove('511') but still the account id is part of the final call.
From the logs:
Calling Webservice Url - https://*****/api/v1/scim/Groups/103 with httpParams - [schemas:[urn:ietf:params:scim:schemas:core:2.0:Group], members:[[value:504], [value:511]]]
RemoveAccessJson
"call": [
{
"name": "Groups",
"connection": "userAuth",
"url": "https://*****/api/v1/scim/Groups/${entitlementValue.entitlementID}",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401
]
}
},
{
"name": "Groups",
"connection": "userAuth",
"url": "https://*****/api/v1/scim/Groups/${entitlementValue.entitlementID}",
"httpMethod": "PUT",
"httpParams": "{\"schemas\": [\"urn:ietf:params:scim:schemas:core:2.0:Group\"],\"members\":${List rolesList = new ArrayList();List responseList = response.Groups1.message.members.collect{it.id};if(response?.Groups1?.message?.members.id==null){return rolesList;}else{responseList.remove(account.accountID);int count=0;int size = responseList.size();for(String str: responseList){count++;rolesList.add('{\"value\":\"'+str+'\"}');if(count == size){return rolesList;}}}}}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,400
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,409
]
}
}
Please let me know if there is any issue with the 2nd call.
02/19/2024 06:51 PM
02/19/2024 07:09 PM
@rushikeshvartak - I followed the same example given by @shivmano. But my use case is to remove the account from the group instead of removing entitlement value. Now, the account ID is a number and it seems the "remove" method takes the input as index rather than the value if given directly. So, responseList.remove(accountID) transaltes to .remove(511), which i believe is not found because there is no index with value as 511.
So somehow I need to convert it to index. I tried as -- int pos=indexof(511) ; responseList.remove(pos). This works perfectly with static values. But then when i use variables --> int pos= indexof(account.accountID); remove(pos) then I get unexpected token $.
Somehow I need to get index of accountID and then use that inside the remove method. Let me know if you see any way to do this.
02/20/2024 11:10 PM
Hi @piyushm
Please refer to the REST Connector's developer handbook. There is step by step instructions on how to construct RemoveAccessJSON. Please validate in postman first before constructing the JSON.
Examples for JSON Construction (saviyntcloud.com)
Regards,
Dhruv Sharma