and more in a single search tool across platforms. Read the announcement here. |
02/12/2024 03:14 PM
Hello,
I have a REST application where the status code is 200 even if there is any failure or bad request.
The status field in the response is either "Failed" or "Success". Below is the response for one failed scenario.
{
"Id": "",
"status": "Failed",
"errorMessage": "'First Name' is a required field. Please enter a value for the field.(SBL-DAT-00498)",
"errorCode": "SBL-CREATEUSER-002"
}
In this case I need to map it to the "status" attribute from the response. I tried using different combinations such as
"successResponses":{
"response.status": "Success"
}
"successResponses":{
"message.status": "Success"
}
"successResponses":{
"message.status": ["Success"]
}
But these are not working and the task gets completed.
Solved! Go to Solution.
02/12/2024 03:30 PM
"successResponses":{
"status": ["Success"]
}
02/13/2024 06:47 AM
Hi @piyushm
Please try with the below snippet
"unsuccessResponses": {
"status": [
"Failed"
]
}
02/13/2024 09:29 AM
try below:
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
"message":["succes"]
},
"unsuccessResponses": {
"message": [
"You must be an admin to add or update an organization membership.",
"Not Found"
]
}
}
02/16/2024 03:23 PM
This works
"successResponses":{
"status": ["Success"]
}
Also, need to note that for this to work in my case, I had to remove statusCode within successResponses and remove the Unsuccessresponses block altogether. So anything which does not equal "Success" will be considered as failed.