Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Rest connector deleting the existing entitlement as per target api build

VijayMaram
Regular Contributor
Regular Contributor

Hi Team,

When we call  https://***/SecurityService/UpdateUser this api is adding entitlement to account. 

{
"Id": 24653,


"Groups":[ {"Id": 871}]
}

24653 is account id

871 is entitlement id

 

But when we try to add another group, old group is getting removed from account and new entitlement is getting added. 

{
"Id": 24653,
"Groups":[ {"Id": 102}]
}

 

But when we pass old entitlements id's along with new entitlements this is working fine.

Is there a way we can pass new entitlement along with existing entitlements in api.

 

getUser Info:


{
"Id": 24653,
"FullName": "User61, Test61",
"Username": "test_user_0061",
"Active": true,
"Locked": false,
"Deleted": false,
"AccountType": 1,
"FirstName": "Test61",
"MiddleName": "",
"LastName": "User61",
"Title": "",
"Language": 1033,
"EmailAddress": "test@test.com",
"HomePhone": "",
"WorkPhone": "",
"MobilePhone": "",
"Fax": "",
"IsSAML": true,
"IsLDAP": false,
"SecurityConfiguration": {
"Id": 7,
"DisplayName": "Standard User Configuration"
},
"APIAccess": false,
"Groups": [
{
"Id": 871,
"Name": "test test Support"
},

{
"Id": 872,
"Name": "test test Support1"
}
],
"SecurityRoles": [
{
"Id": 12,
"Name": "CM_Awareness_User"
}
],
"FunctionalRoles": []
}

 

15 REPLIES 15

rushikeshvartak
All-Star
All-Star

Refer https://forums.saviynt.com/t5/community-knowledge-base/rest-conn-retain-existing-entitlements-and-on...


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

VijayMaram
Regular Contributor
Regular Contributor

@rushikeshvartak  / All,


Thanks for reviewing this.
I tried to fallow the given forum link. 

But from call1 response we are getting is as fallow. 
{
"Id": 24653,
"Groups":[ {"Id": 102},{"Id": 103}]
}

I have tried to render the values but alwasy getting error like 

","DEBUG","Exit encryptHeaders"
"2024-08-14T19:14:53.321+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-8-8vmjf","DEBUG","Task Res"auditDetails":{"Groups":[{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: {\"Id\": \"${account.accountID}\",\"Groups\":[${List roleNameList = response.call1.message.Groups.collect{it.toString()}; roleNameList.add(entitlementValue.entitlement_value.toString());String rolesStr = roleNameList.toString().replace('[','').replace(']','').replace('\"','');return rolesStr;}]}; line: 1, column: 42]","status":"Failed"}]},"Groups":{"message":"Unexpected character ('L' (code 76)): was expecting double-quote to start field name\n at [Source: {\"Id\": \"24654\",\"Groups\":[{List roleNameList = response.call1.message.Groups.collect{it.toString()}; roleNameList.add(entitlementValue.entitlement_value.toString());String rolesStr = roleNameList.toString().replace('[','').replace(']','').replace('\"','');return rolesStr;}]}; line: 1, column: 28]","status":"Failed"}}"
"2024-08-14T19:14:53.321+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-8-8vmjf","DEBUG","Result: false"

Please share log file in text file


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

Hi @rushikeshvartak 

I have tried making changes to code. But every time getting $ unrecognized error. Logs attached. Few jsons which tried also attached.

Sample response from Call 1: 

stalluri
Valued Contributor
Valued Contributor

@VijayMaram 

{
    "call": [
        {
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://****-sandbox.****grc.com:4443/SecurityService/GetGroup?id=${entitlementValue.entitlementID}",
            "httpParams": "{}",
            "httpHeaders": {
                "Cookie": "${access_token}",
                "Content-Type": "application/json",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "httpMethod": "GET",
            "successResponses": {
                "statusCode": [
                    200,
                    201,
                    204
                ]
            },
            "unsuccessResponses": {
                "statusCode": [
                    400,
                    403,
                    401,
                    404,
                    409,
                    500,
                    501
                ]
            }
        },
        {
            "name": "Groups",
            "connection": "acctAuth",
            "url": "https://****-sandbox.****grc.com:4443/SecurityService/UpdateGroup",
            "httpParams": "{\"Id\": \"${entitlementValue.entitlementID}\",\"Users\": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.collect { user -> user.Id != entitlementValue.entitlement_value ? user.Id : null }.findAll { it != null }; filteredRoles.collect { \"${it}\" }.join(',')}]}}",
            "httpHeaders": {
                "Cookie": "${access_token}",
                "Content-Type": "application/json",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "httpMethod": "POST",
            "successResponses": {
                "statusCode": [
                    200,
                    201,
                    204
                ]
            },
            "unsuccessResponses": {
                "statusCode": [
                    400,
                    403,
                    401,
                    404,
                    409,
                    500,
                    501
                ]
            }
        },
        {
            "name": "call2",
            "connection": "acctAuth",
            "url": "https://****-sandbox.****grc.com:4443/SecurityService/Logout",
            "httpMethod": "GET",
            "httpHeaders": {
                "Cookie": "${access_token}",
                "Content-Type": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200,
                    201
                ]
            }
        }
    ]
}

Best Regards,
Sam Talluri
If you find this a helpful response, kindly consider selecting Accept As Solution and clicking on the kudos button.

VijayMaram
Regular Contributor
Regular Contributor

Hi @stalluri 

Thanks for checking this. I am still getting similar error.

 

"2024-09-16T13:23:59.383+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-4-d8l6m","DEBUG","Total Call: 1"
"2024-09-16T13:23:59.404+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-4-d8l6m","DEBUG","connection: acctAuth"
"2024-09-16T13:23:59.448+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-4-d8l6m","ERROR","Error in processWebservicecom.fasterxml.jackson.core.JsonParseException: Unrecognized token '$': was expecting ('true', 'false' or 'null')| at [Source: {"Id": "${entitlementValue.entitlementID}","Users": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.collect { user -> user.Id != entitlementValue.entitlement_value ? user.Id : null }.findAll { it != null }; filteredRoles.collect { "${it}" }.join(',')}]}}; line: 1, column: 55]"
"2024-09-16T13:23:59.449+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-4-d8l6m","DEBUG","Enter encryptHeaders"
"2024-09-16T13:23:59.449+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-4-d8l6m","DEBUG","Exit encryptHeaders"
"2024-09-16T13:23:59.450+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-4-d8l6m","DEBUG","Task Response: {"Groups":{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: {\"Id\": \"${entitlementValue.entitlementID}\",\"Users\": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.collect { user -> user.Id != entitlementValue.entitlement_value ? user.Id : null }.findAll { it != null }; filteredRoles.collect { \"${it}\" }.join(',')}]}}; line: 1, column: 55]","status":"Failed"}}"

Any pointers will be great help.

stalluri
Valued Contributor
Valued Contributor

@VijayMaram 

Can you share the postman CURL when you pass the values?


Best Regards,
Sam Talluri
If you find this a helpful response, kindly consider selecting Accept As Solution and clicking on the kudos button.

VijayMaram
Regular Contributor
Regular Contributor

Hi @stalluri 

 we are using command prompt.

Any be low is curl command we use.

Details added.

Did you validated with hardcoded value 


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

stalluri
Valued Contributor
Valued Contributor

@VijayMaram 

{

"httpParams": "{\"Id\": \"${entitlementValue.entitlementID}\",\"Name\": \"API Group\",\"Description\": \"Another API update.\",\"BusinessUnit\": false,\"Users\": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != entitlementValue.entitlement_value }; filteredRoles.collect { \"{\\\"Id\\\": \" + it.Id + \"}\" }.join(',')}],\"ParentGroups\": [{\\\"Id\\\": 2},{\\\"Id\\\": 3}]}"

}


Best Regards,
Sam Talluri
If you find this a helpful response, kindly consider selecting Accept As Solution and clicking on the kudos button.

VijayMaram
Regular Contributor
Regular Contributor

Hi @rushikeshvartak 


Yes, when i tried to pass json as fallow, task getting completed successfully.

"url": "https://****-sandbox.****grc.com:4443/SecurityService/UpdateGroup",
"httpParams": "{\"Id\": \"${entitlementValue.entitlementID}\",\"Users\": [{\"Id\": ${account.accountID}}]}",

OR 
"{\"Id\": \"${entitlementValue.entitlementID}\",\"Users\": [{\"Id\": 24654},{\"Id\": 24656},{\"Id\": 24655}]}",

Above both the cases were working fine. Logs for second usecase.


2024-09-16T13:41:58-05:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-8-d8l6m-DEBUG-timeout validated for api...

2024-09-16T13:41:58-05:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-8-d8l6m-DEBUG-got response for api...

2024-09-16T13:41:58-05:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-8-d8l6m-DEBUG-Got showLogs = true

2024-09-16T13:41:58-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-8-d8l6m-DEBUG-Got Webservice API Response: [headers:[Cache-Control: no-cache, no-store, must-revalidate, Pragma: no-cache, Content-Type: application/json, Expires: -1, Vary: Accept-Encoding, Server: , Strict-Transport-Security: max-age=31536000; includeSubDomains; preload, X-ASPNET-VERSION: , X-POWERED-BY: , Date: Mon, 16 Sep 2024 18:41:58 GMT], responseText:{| "Id": 871,| "Name": "**** Keylight Support",| "Description": "Membership of this group requires approval from Marqueta Lee, Jerry Lefler, or Ted Keith. **** Keylight Support ",| "BusinessUnit": false,| "LDAPDirectory": {| "Id": 3,| "DisplayName": "RemoteDirectorySync_Sandbox"| },| "LDAPGroupName": "KL_SupportGroup_P",| "LDAPGroupDN": "CN=KL_SupportGroup_P,OU=Keylight Groups,OU=**** Groups,DC=****,DC=com",| "SecurityRoles": [| {| "Id": 5,| "Name": "CM_CDocs_Maintainer"| },| {| "Id": 39,| "Name": "Platform_Config_Read"| },| {| "Id": 115,| "Name": "****_Keylight_Support "| }| ],| "Users": [| {| "Id": 24654,| "FullName": "User49, Test49"| },| {| "Id": 24655,| "FullName": "User65, Test65"| },| {| "Id": 24656,| "FullName": "LU101, TU101"| }| ],| "ChildGroups": [],| "ParentGroups": []|}, cookies:[], statusCode:200]

What current issue then ?


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

Hi @rushikeshvartak 

If we try to add single user to entitlement then api is removing the existing users and adding only the current user.

So we are trying to call the list of user details api for entitlement and trying to add this users list to selected user.

Old list : [{1},{2}]
New list: [{1},{2},{3}] 
3 is newly selected user through ARS.

@stalluri 

Getting error as fallow:

2024-09-16T14:07:40-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-7-d8l6m-DEBUG-connection: acctAuth
 
2024-09-16T14:07:40-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-7-d8l6m-ERROR-Error in processWebservicecom.fasterxml.jackson.core.JsonParseException: Unrecognized token '$': was expecting ('true', 'false' or 'null')| at [Source: {"Id": "${entitlementValue.entitlementID}","Name": "API Group","Description": "Another API update.","BusinessUnit": false,"Users": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != entitlementValue.entitlement_value }; filteredRoles.collect {"{\"Id\": " + it.Id + "}" }.join(',')}]}; line: 1, column: 134]
 
2024-09-16T14:07:40-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-7-d8l6m-DEBUG-Enter encryptHeaders
 
2024-09-16T14:07:40-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-7-d8l6m-DEBUG-Exit encryptHeaders
 
2itDetails":{"Groups":[{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: {\"Id\": \"${entitlementValue.entitlementID}\",\"Name\": \"API Group\",\"Description\": \"Another API update.\",\"BusinessUnit\": false,\"Users\": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != ${account.accountID} }; filteredRoles.collect {\"{\\\"Id\\\": \" + it.Id + \"}\" }.join(',')}]}; line: 1, column: 134]","status":"Failed"}]},"Groups":{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: {\"Id\": \"${entitlementValue.entitlementID}\",\"Name\": \"API Group\",\"Description\": \"Another API update.\",\"BusinessUnit\": false,\"Users\": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != entitlementValue.entitlement_value }; filteredRoles.collect {\"{\\\"Id\\\": \" + it.Id + \"}\" }.join(',')}]}; line: 1, column: 134]","status":"Failed"}}

Hi @stalluri  and @rushikeshvartak 

I have tried removing $ from the JSON. Below is the new error i am getting.

2024-09-16T14:25:54-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-8-d8l6m-ERROR-Error in processWebservicecom.fasterxml.jackson.core.JsonParseException: Unexpected character ('L' (code 76)): was expecting double-quote to start field name| at [Source: {"Id": "871","Name": "API Group","Description": "Another API update.","BusinessUnit": false,"Users": [{List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != 24655 }; filteredRoles.collect {"{\"Id\": " + it.Id + "}" }.join(',')}]}; line: 1, column: 105]
 
2024-09-16T14:25:54-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-8-d8l6m-DEBUG-Enter encryptHeaders
 
2024-09-16T14:25:54-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-8-d8l6m-DEBUG-Exit encryptHeaders
 
2024-09-16T14:25:54-05:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-8-d8l6m-DEBU{"Groups":[{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: {\"Id\": \"${entitlementValue.entitlementID}\",\"Name\": \"API Group\",\"Description\": \"Another API update.\",\"BusinessUnit\": false,\"Users\": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != ${account.accountID} }; filteredRoles.collect {\"{\\\"Id\\\": \" + it.Id + \"}\" }.join(',')}]}; line: 1, column: 134]","status":"Failed"},{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: {\"Id\": \"${entitlementValue.entitlementID}\",\"Name\": \"API Group\",\"Description\": \"Another API update.\",\"BusinessUnit\": false,\"Users\": [${List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != entitlementValue.entitlement_value }; filteredRoles.collect {\"{\\\"Id\\\": \" + it.Id + \"}\" }.join(',')}]}; line: 1, column: 134]","status":"Failed"},{"message":"Unexpected character ('L' (code 76)): was expecting double-quote to start field name\n at [Source: {\"Id\": \"871\",\"Name\": \"API Group\",\"Description\": \"Another API update.\",\"BusinessUnit\": false,\"Users\": [{List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != 24655 }; filteredRoles.collect {\"{\\\"Id\\\": \" + it.Id + \"}\" }.join(',')}]}; line: 1, column: 105]","status":"Failed"}]},"Groups":{"message":"Unexpected character ('L' (code 76)): was expecting double-quote to start field name\n at [Source: {\"Id\": \"871\",\"Name\": \"API Group\",\"Description\": \"Another API update.\",\"BusinessUnit\": false,\"Users\": [{List responseList = response.call1.message.Users; List filteredRoles = responseList.findAll { it.Id != 24655 }; filteredRoles.collect {\"{\\\"Id\\\": \" + it.Id + \"}\" }.join(',')}]}; line: 1, column: 105]","status":"Failed"}}