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

Not able to delete account using REST API - getting 422 erorr

nmand396
New Contributor
New Contributor

HI team,

 

I have remove account payload which works pretty well in Postman. But when configured with Saviynt it fails with "message":{"status":"422","errors":["Invalid Object."],"message":"Invalid Object."},"statusCode":422,"description":null,"status":"Failed

Postman curl;

curl --location --request DELETE 'https://abc.domain.com/provision/users' \
--header 'access-token: xxxxx=' \
--header 'api-version: 2.0.0' \
--header 'Content-Type: text/plain' \

--data '{"EID":"cjohn023"}'

 

and i have configured json in saviynt as 

{"call":[{"name":"call1","connection":"userAuth","url":"https://abc.domain.com/provision/users","httpMethod":"DELETE","httpParams":"{\"eid\": \"${user.username}\"}","httpHeaders":{"api-version":"2.0.0","access-token":"${access_token}","Content-Type":"text/plain"},"httpContentType":"text/plain","successResponses":{"message":"User deprovisioned successfully"}}]}

 

can someone let me know how do i form this json correctly. 

 

9 REPLIES 9

naveenss
All-Star
All-Star

Hi @nmand396 a few quick questions.

1. Are you using the above JSON in the removeAccountJSON of the connector?

2. In the postman payload, if you're passing the EID in lowercase (eid), is it still working? (just to rule out any case-sensitive issue).

 

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.

saipraveengv
New Contributor III
New Contributor III

hi @Naveen ,

No change with Upper or lower case. 

yes, i am using above json. 

Hi @saipraveengv 

Can you pass the Content type as application/json instead of plain text and try it out.

 

Thanks

Darshan

Tried. It did not work. There is something else is missing in the json

Try the below json and let me know what error you are getting if it fails

 

{
"call": [{
"name": "call1",
"connection": "userAuth",
"url": "https://abc.domain.com/provision/users",
"httpMethod": "DELETE",
"httpParams": "{\"eid\": \"${user.username}\"}",
"httpHeaders": {
"api-version": "2.0.0",
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"message": "User deprovisioned successfully"
}
}]
}

 

Thanks

Darshan

nmand396
New Contributor
New Contributor

 

Same error 

2023-08-04 12:05:41,905 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - pullObjectsByRest - responseStatusCode ::422
2023-08-04 12:05:41,906 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - Entered getResponseHeaders method
2023-08-04 12:05:41,906 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - responseError : null
2023-08-04 12:05:41,906 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - isAuthError: false
2023-08-04 12:05:41,906 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - pullObjectsByRest - responseMap.size : 3
2023-08-04 12:05:41,906 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - pullObjectsByRest - objectList.size : 1
2023-08-04 12:05:41,906 [quartzScheduler_Worker-13] ERROR rest.RestProvisioningService - Call response: {"status":"422","errors":["Invalid Object."],"message":"Invalid Object."}
2023-08-04 12:05:41,907 [quartzScheduler_Worker-13] ERROR rest.RestProvisioningService - callResponseMap: [status:422, errors:[Invalid Object.], message:Invalid Object.]
2023-08-04 12:05:41,907 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - showResponse: null
2023-08-04 12:05:41,907 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - doBreak: false
2023-08-04 12:05:41,907 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - Task Response: {"auditDetails":{"call1":[{"headers":{"Keep-Alive":"timeout=5, max=100","Server":"Apache","X-Content-Type-Options":"nosniff","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,OPTIONS","Connection":"Keep-Alive","Date":"Fri, 04 Aug 2023 12:02:50 GMT","Access-Control-Allow-Headers":"Content-Type, api-version, access-token, api-token","Referrer-Policy":"origin-when-cross-origin","Strict-Transport-Security":"max-age=31536000; includeSubDomains; preload","Cache-Control":"no-cache","Content-Security-Policy":"frame-ancestors 'self' outlook.office.com outlook.office365.com *.microsoft.com;","X-XSS-Protection":"1; mode=block","Content-Length":"146","Content-Type":"application/json"},"message":{"status":"401","errors":["The valid access-token parameter is required."],"message":"The valid access-token parameter is required.","code":30200},"statusCode":200,"description":null,"status":"Failed"}]},"call1":{"headers":{"Keep-Alive":"timeout=5, max=100","Server":"Apache","X-Content-Type-Options":"nosniff","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,OPTIONS","Connection":"Keep-Alive","Date":"Fri, 04 Aug 2023 12:05:41 GMT","Access-Control-Allow-Headers":"Content-Type, api-version, access-token, api-token","Referrer-Policy":"origin-when-cross-origin","Strict-Transport-Security":"max-age=31536000; includeSubDomains; preload","Cache-Control":"no-cache","Content-Security-Policy":"frame-ancestors 'self' outlook.office.com outlook.office365.com *.microsoft.com;","X-XSS-Protection":"1; mode=block","Content-Length":"73","Content-Type":"application/json"},"message":{"status":"422","errors":["Invalid Object."],"message":"Invalid Object."},"statusCode":422,"description":null,"status":"Failed"}}
2023-08-04 12:05:41,908 [quartzScheduler_Worker-13] DEBUG rest.RestProvisioningService - Result: false

It is also saying valid access token to be passed

{"status":"401","errors":["The valid access-token parameter is required."],"message":"The valid access-token parameter is required.","code":30200},"statusCode":200,"description":null,"status":"Failed"}]},"

 

Can you check if you are passing the correct token as well

 

Thanks

Darshan

 

422 validation error
 
The 422 (Unprocessable Entity) status code indicates that the server recognized the requested entity's content type but was unable to process the instructions contained within it.
Hardcode access token and try, share postman screenshot.
 
 
{
"call": [{
"name": "call1",
"connection": "userAuth",
"url": "https://abc.domain.com/provision/users",
"httpMethod": "DELETE",
"httpParams": "{\"EID\": \"${user.username}\"}",
"httpHeaders": {
"api-version": "2.0.0",
"Authorization": "${access_token}",
"Accept": "text/plain"
},
"httpContentType": "text/plain",
"successResponses": {
"message": "User deprovisioned successfully"
}
}]
}

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

Vedanth_BK
Saviynt Employee
Saviynt Employee

Hi @nmand396,

Analyzing the JSON and the debug logs provided above I see that the HttpMethod is DELETE and has body parameters. In such cases, the HttpMethod in the JSON needs to be DELETEWITHBODY
for more information and sample, please refer to the REST connector Guide under the developer's handbook.

Vedanth_BK_0-1691398680949.png

Thank you 
Vedanth B.K