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

UpdateUserJSON Rest

iam01
Regular Contributor
Regular Contributor

Hi Team,

am doing  a writeback to a target application using user update json. The isssue i see is irrespective of success or failure task is getting completed and in logs i can see that the api returned 400 response. I tried unsucessResponse json but its not working. Is there any limitation with update user json?

 

PFA

{
"actions": {
"Update Login": {
"call": [
{
"name": "call1",
"connection": "acctAuth",
"callOrder": 0,
"url": "https://zendesk.co/hr/v1/email.change",
"httpMethod": "POST",
"httpContentType": "application/json",
"httpParams": "{\"events\":[{\"data\":{\"transform\":{\"worker\":{\"id\":{\"email\":{\"emailUri\":\"1234@dfs.com\"}}}}}}]}",
"httpHeaders": {
"Authorization": "${access_token}"
},

 "successResponses": {
                        "statusCode": [
                            200
                        ]
                    },

"unsuccessResponses": {
"statusCode": [
null,
400,
401,
403,
404,
405,
409
]
}
}
]
}
}
}

 

 

 

Logs:

 

2023-08-30T19:38:13.773106538Z stdout F 2023-08-30 19:38:13,773 [quartzScheduler_Worker-1] DEBUG rest.RestUtilService - pullObjectsByRest - responseStatusCode ::400



11 REPLIES 11

Darshanjain
Saviynt Employee
Saviynt Employee

Hi @iam01 

If you make the Api call from postman is it working fine giving 200 success response.

 

Thanks

Darshan

iam01
Regular Contributor
Regular Contributor

The problem/ QQ was, when the API returns 400 as a response, I want the task to fail. Currently, however, regardless of the API response code, the task is marked as completed.

Hi @iam01 

Can you please add this as well in the update user json

"successResponsePath": "responseText".

You can get the path from the postman when Api is failed or you can get it from this config showlogs=true in config json param in connection level and check the logs.

 

Also would suggest you to remove  unsuccessResponses and keep only success response so that any other response system will treat it as unsuccess.

 

Thanks

Darshan

iam01
Regular Contributor
Regular Contributor

Thanks Darshan, i will test and update shortly. @Darshanjain QQ, i could not find much about "configJson" in rest documentation, Could you please share any link where i can go through configJson. 


Am refering below link:
https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm

iam01
Regular Contributor
Regular Contributor

@Darshanjain  after adding that showlogs, i didnt see signfincat differnece in logging however,below is the api response from postman.


{
    "events": [
        {
            "eventStatusCode": {
                "codeValue": "complete",
                "shortName": "complete"
            },
            "data": {
                "eventContext": {
                    "worker": {
                        "id": "d56356563"
                    }
                },
                "output": {
                    "worker": {
                        "businessCommunication": {
                            "email": {
                                "emailUri": "asdfds@dfre.com"
                            }
                        }
                    }
                }
            }
        }
    ]
}

 

Hi @iam01 

In logging you should be able to the success response path, As per postman it is a blank one so you can put the below and try it out.

"successResponsePath": "responseText".

 

Thanks

Darshan

I see you accepted the solution, did it work @iam01 

 

Thanks

Darshan

iam01
Regular Contributor
Regular Contributor

Yes it worked.

iam01
Regular Contributor
Regular Contributor
"successResponsePath": "responseText",
 
"successResponses": {
                        "statusCode": [
                            200
                        ]
                    }
 
 
i have configured above and its not working. @Darshanjain  am i missing anything?

iam01
Regular Contributor
Regular Contributor

LOGS:

responseText:{confirmMessage":{"confirmMessageID":{"idValue":"D90C-B55C5E04816F"

2023-09-05T14:01:17.476421845Z stdout F 2023-09-05 14:01:17,476 [quartzScheduler_Worker-5] DEBUG rest.RestUtilService - pullObjectsByRest - responseStatusCode ::400