Click HERE to see how Saviynt Intelligence is transforming the industry. |
03/21/2024 10:36 AM
I have a REST connector and I want to treat two different responses to AddAccessJSON as successful:
200 status code
OR the specific message in the response example from Postman:
{
"error": {
"code": "openaccess.general.invalidrequestitem",
"message": "There is already an access level assignment for this access level and badge."
},
"version": "1.0"
}
I've tried a few combinations of setting successResponse like:
"successResponses": [
"statusCode": [ 200 ],
"error.message": [ "There is already an access level assignment for this access level and badge." ]
]
using different variations like "message" "message.error.message", and "error.message".
Is there a way to do what I want here?
03/21/2024 12:10 PM
try like below
{
"accountIdPath": "call1.message.user.id"
}
if going to use message property ,above tag should will be der in json then message property will work
"successResponses": {
"message": [
"There is already an access level assignment for this access level and badge."
]
}
or
"successResponses": {
"result[0].status": "There is already an access level assignment for this access level and badge"
}
03/21/2024 02:49 PM
I'm sorry, I don't understand your reply. I need to accept either statusCode 200 or the message "There is already an access level assignment for this access level and badge."
What do I need to put in successResponses to test for either case?
03/21/2024 06:36 PM
You can either use HTTP Status code or Message not both
03/22/2024 06:41 AM
Thank you for the clarification.
Can I validate on two different messages? Something like:
"successResponses": [
{ "status": "There is already an access level assignment for this access level and badge." },
{ "type_name": "Success" }
]
and ignore the HTTP status code entirely?
03/22/2024 08:06 AM
I am trying to get it working with just a single successResponses value, and have been unsuccessful. I have tried:
"successResponses": { "message":"There is already an access level assignment for this access level and badge." }
"successResponses": { "error.message":"There is already an access level assignment for this access level and badge." }
"successResponses": { "response.error.message":"There is already an access level assignment for this access level and badge." }
"successResponses": { "response.error.message":"There is already an access level assignment for this access level and badge." }
"successResponses": { "message": [ "There is already an access level assignment for this access level and badge." ] }
"successResponses": { "error.message": [ "There is already an access level assignment for this access level and badge." ] }
This seems like it should be simple, but I cannot find the correct syntax.
My full AddAccessJSON is simply:
{
"call": [{
"name": "AccessLevel",
"connection": "acctAuth",
"url": "https://xxx:8080/api/access/onguard/openaccess/instances?version=1.0&session_token=${access_token}&type_name=Lnl_AccessLevelAssignment",
"httpMethod": "POST",
"httpParams": "{\"property_value_map\": {\"ACCESSLEVELID\": \"${entitlementValue.entitlementID}\",\"BADGEKEY\":\"${account.customproperty1}\"}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": { "message": { "There is already an access level assignment for this access level and badge." } }
}
]
}
when I make the call manually through postman, it returns:
{
"error": {
"code": "openaccess.general.invalidrequestitem",
"message": "There is already an access level assignment for this access level and badge."
},
"version": "1.0"
}
and I want Saviynt to treat that as success.
03/22/2024 08:12 AM
"successResponses": {
"error[0].message": "
There is already an access level assignment for this access level and badge."}
03/22/2024 08:12 AM
Disclaimer - This is an AI generated response and feedback will be used to fine tune.
To accommodate both scenarios you described (a 200 status code or a specific message in the response) as success conditions for AddAccessJSON in the Saviynt REST connector, you need to properly format the successResponses section to include both types of successful responses. Based on the guidelines provided in the REST Connector Guide and the scenario you've outlined, here's how you could structure your JSON.
{
"successResponses": [
{
"statusCode": [200]
},
{
"responsePath": "error.message",
"values": ["There is already an access level assignment for this access level and badge."]
}
]
}
In this structure:
This configuration ensures that the REST connector treats both a 200 status code and the presence of the specified message in the response as indicators of success. Remember, the actual JSON path (error.message in the example) may need to be adjusted based on the exact structure of the API response you're working with.