PARTNERS - Please join us for our upcoming webinar:
Leveraging Intelligent Recommendations for Operational Transformation.
AMS Partners click HERE | EMEA/APJ Partners click HERE

Issue with RemoveAccessJSON

shivmano
Regular Contributor III
Regular Contributor III

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 

4 REPLIES 4

rushikeshvartak
All-Star
All-Star

Add Callnumber and stageOrder


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

shivmano
Regular Contributor III
Regular Contributor III

@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 ? 

Hi @shivmano can you share the working addAccessJSON?

 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

shivmano
Regular Contributor III
Regular Contributor III

@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
]
}
}
]
}