We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Add Access JSON for REST

rituparna_pwc
Regular Contributor
Regular Contributor

Can anyone help here

We have a use case where existing role of user gets returned in Array of String, when user request for new entitlements, AddAccess JSON should get current entitlement and then add new requested entitlements.  The call is returning existing entitlements

We are trying the JSON but getting error

"Designations2":{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: {\"employeeid\": \"${response.Designations1.message.Users[0].EmployeeID}\", \"employeename\": \"${response.Designations1.message.Users[0].EmployeeName}\", \"emailaddress\": \"${response.Designations1.message.Users[0].EmailAddress}\",\"designationcodes\": ${List roleNameList = new ArrayList(); roleNameList=response.Designations1.message.Users[0].DesignationCodes.collect{it.toString()};List newRole = new ArrayList();newRole=newRole.add(entitlementValue.entitlementID);newRole.addAll(roleNameList);return newRole;}, \"flag\": \"update\" }; line: 1, column: 243]","status":"Failed"}}

 

 

 

Add Access JSON:

{
"call": [
{
"name": "Designations",
"connection": "userAuth",
"url": "https:/xxxxx/webapistg/api/Saviynt/GetUserList/${account.accountID}",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}",
"httpContentType": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
},
"unsuccessResponses": {
"statusCode": [
400,
401
]
}
},
{
"name": "Designations",
"connection": "userAuth",
"url": "https://xxxxx/webapistg/api/Saviynt/UserService",
"httpMethod": "POST",
"httpParams": "{\"employeeid\": \"${response.Designations1.message.Users[0].EmployeeID}\", \"employeename\": \"${response.Designations1.message.Users[0].EmployeeName}\", \"emailaddress\": \"${response.Designations1.message.Users[0].EmailAddress}\",\"designationcodes\": ${List roleNameList = new ArrayList(); roleNameList=response.Designations1.message.Users[0].DesignationCodes.collect{it.toString()};List newRole = new ArrayList();newRole=newRole.add(entitlementValue.entitlementID);newRole.addAll(roleNameList);return newRole;}, \"flag\": \"update\" }",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401
]
}
}
]
}

2 REPLIES 2

sk
All-Star
All-Star

@rituparna_pwc : I see a JSON format issue,(Missing double quotes for designationcodes.

Can you try below JSON

{
    "call": [
        {
            "name": "Designations",
            "connection": "userAuth",
            "url": "https:/xxxxx/webapistg/api/Saviynt/GetUserList/${account.accountID}",
            "httpMethod": "GET",
            "httpParams": "",
            "httpHeaders": {
                "Authorization": "${access_token}",
                "httpContentType": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200,
                    201
                ]
            },
            "unsuccessResponses": {
                "statusCode": [
                    400,
                    401
                ]
            }
        },
        {
            "name": "Designations",
            "connection": "userAuth",
            "url": "https://xxxxx/webapistg/api/Saviynt/UserService",
            "httpMethod": "POST",
            "httpParams": "{\"employeeid\": \"${response.Designations1.message.Users[0].EmployeeID}\", \"employeename\": \"${response.Designations1.message.Users[0].EmployeeName}\", \"emailaddress\": \"${response.Designations1.message.Users[0].EmailAddress}\",\"designationcodes\": \"${List roleNameList = new ArrayList(); roleNameList=response.Designations1.message.Users[0].DesignationCodes.collect{it.toString()};List newRole = new ArrayList();newRole=newRole.add(entitlementValue.entitlementID);newRole.addAll(roleNameList);return newRole;}\", \"flag\": \"update\"}",
            "httpHeaders": {
                "Authorization": "${access_token}",
                "Content-Type": "application/json",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200
                ]
            },
            "unsuccessResponses": {
                "statusCode": [
                    400,
                    401
                ]
            }
        }
    ]
}

 


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

rituparna_pwc
Regular Contributor
Regular Contributor

@sk , it was resolved with below JSON

 

{
"call": [
{
"name": "Designations",
"connection": "userAuth",
"url": "https://xxxxxxxxxxxxxxxxx/webapistg/api/Saviynt/GetUserList/${account.accountID}",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}",
"httpContentType": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
},
"unsuccessResponses": {
"statusCode": [
400,
401
]
}
},
{
"name": "Designations",
"connection": "userAuth",
"url": "https://xxxxxxxxxxxxxxxxxx/webapistg/api/Saviynt/UserService",
"httpMethod": "POST",
"httpParams": "{\"employeeid\": \"${response.Designations1.message.Users[0].EmployeeID}\", \"employeename\": \"${response.Designations1.message.Users[0].EmployeeName}\", \"emailaddress\": \"${response.Designations1.message.Users[0].EmailAddress}\",\"designationcodes\": ${List oldGroupList = response.Designations1.message.Users[0].DesignationCodes; oldGroupList.add(entitlementValue.entitlementID); return new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(oldGroupList);}, \"flag\": \"update\" }",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401
]
}
}
]
}