Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Account’s entitlement check REST Add Access

AbhiSingh
New Contributor II
New Contributor II

Hi I want to send \”Action”\:\”Update\” if account has any associated entitlement in my endpoint in Saviynt or else send \”Action”\:\”SAVE\” to the target . How can I achieve this please?

14 REPLIES 14

amit_krishnajit
Saviynt Employee
Saviynt Employee

What kind of JSON are you referring to here? Is this create account or update account or add access? 

 

Thanks,
Amit

This is for Add Access.

amit_krishnajit
Saviynt Employee
Saviynt Employee

One way to do this is using multiple calls in the Add Access JSON. 1st call - make API call to get all the assigned entitlements for the user from the target. 2nd call - determine the existing entitlements for the account based on output of the 1st call, and proceed to have if-condition for the Action in the 2nd call. 

 

Thanks,
Amit

Hi yes, Im trying this only now. here is the postman response of first call

[{"active":false,"isTACUser":false,"profiles":[]}

I want to check if Active=false in GET , then POST SAVE else post UPDATE . For this I've written below JSON for Action attribute. However it keeps sending UPDATE. Am I missing anything?

\"action\": \"${(response.ROLE1.message.active=='false')?'SAVE':'UPDATE'}\",

I did try message[0].active=='false' too. didntwork

 

amit_krishnajit
Saviynt Employee
Saviynt Employee

You may want to try the following:

${('false'.equalsIgnoreCase(response.'ROLE1'.message.active)) ? 'SAVE' : 'UPDATE' }

Please post the full JSON that you are using.

 

Thanks,
Amit

Now below is the error response. please note that now task is NOT getting closed !

{"GACROLE1":{"headers":"XXXXXX","message":[{"active":false,"isTCCUser":false,"profiles":[]}],"statusCode":200,"description":null,"status":"Success"},"auditDetails":{"GACROLE2":[{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: [Printing whole JSON of httpParams of ADD access , THEN line: 1, column: 339] (through reference chain: java.util.ArrayList[0])","status":"Failed"}

Action Attribute JSON : \"action\": \"${('false'.equalsIgnoreCase(response.'GACROLE1'.message.active)) ? 'SAVE' : 'UPDATE' }\",

I assumed that the false/true would be string. 

You may want to try the following:

${(false==response.'GACROLE1'.message.active) ? 'SAVE' : 'UPDATE' }

 

Thanks,
Amit

Now something strange happening, first time I run WSretry, the Add Access task doesn't get completed and throws similar error as above but on different column, " line: 1, column: 318] (through reference chain: java.util.ArrayList[0])","status":"Failed"}]},"

When I rerun  WSretry, task gets completed but I see in the Saviynt logs, action was sent as 'UPDATE'

Share full JSON


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

.

Did you tried 

${(false==response.'GACROLE'.message.active) ? 'SAVE' : 'UPDATE' }


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Let me retry now..I think I tried

I tried this now and task is not being completed. I see the first call was a success. GACROLE2 has error like shared earlier

{"GACROLE1":{"headers":"XXXXXX","message":[{"active":false,"isTCCUser":false,"profiles":[]}],"statusCode":200,"description":null,"status":"Success"},"auditDetails":{"GACROLE2":[{"message":"Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: [Printing whole JSON of httpParams of ADD access , THEN line: 1, column: 319] (through reference chain: java.util.ArrayList[0])","status":"Failed"}

AbhiSingh
New Contributor II
New Contributor II

I tried the below and for my first task, it sent SAVE  and another it sent UPDATE. thanks @amit_krishnajit @rushikeshvartak for your help so far. Appreciate it!

\"action\": \"${(false==response.GACROLE1.message[0].active) ? 'SAVE' : 'UPDATE' }\"

however, not sure why Add Access task is getting closed ONLY when I run the Wsretry twice. now another concern is, when I raised 1 access request for 2 entitlements together, it sent SAVE for both ? But I think it is happening because active is not changing immediately from false to true as when I raise another access request, in the GET call we are getting active:true and and then it sent UPDATE.