PARTNERS - Please join us for our upcoming webinar:
Leveraging Intelligent Recommendations for Operational Transformation.
AMS Partners click HERE | EMEA/APJ Partners click HERE

unsuccessResponses in REST connector

shivmano
Regular Contributor III
Regular Contributor III

Hi Team - 

I have a REST application, that returns a 200 status code for Add Access both in case of success and failure. Below is the response in case of failure and the add access json I am using. I would like to map the "isSuccess": false response item in the unsuccessResponses so that the task does not move to completed, when there is an error. Please can anyone advise how this can be read? 

Failure response:

{
    "operationResult": {
        "userId": null,
        "isSuccess": false,
        "errors": [
            {
                "key": 5102,
                "value": "You are trying to invite a user from outside your directory, but something went wrong. Please contact support."
            }
        ],
        "result": null
    },
    "isSuccess": false,
    "userEntitlement": null
}
 
Add Access JSON I am using currently:
 
{
"call": [
{
"name": "OrgNew",
"connection": "userAuth",
"url": "https://******/${entitlementValue.entitlement_value}/_apis/UserEntitlements?api-version=6.0-preview.1",
"httpMethod": "POST",
"httpParams": "{\"accessLevel\": {\"accountLicenseType\": \"${requestAccessAttributes.get('typeofaccess')}\"},\"user\": {\"principalName\": \"${account.name}\",\"subjectKind\": \"user\"}}",
"httpHeaders": {
"Content-Type": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
408,
500
]
}
}
]
}
2 REPLIES 2

NM
Honored Contributor
Honored Contributor

Hi @shivmano , remove stausCode and add

 "isSuccess": [false] or  "isSuccess"false

shivmano
Regular Contributor III
Regular Contributor III

Thank you @NM , I was able to use "operationResult.isSuccess": false