Anton_Vroon | 2024-05-31 00:57:12 UTC | #1
I'm just trying to figure out how to not get a 400 response for a DataAction I have URL is /api/v2/outbound/contactlists/${input.contactListId}/contacts/${input.contactId}
Response template looks like this { "translationMap": {}, "translationMapDefaults": {}, "successTemplate": "{\"raw_json\": \"$esc.jsonString(\"${rawResult}\")\" }" }
So this just looks up a contact in a contact list, and returns the results as raw json. Success path when contact is found works great. But if the Contact is not found it throws a 400 response and goes down the failure path. I'm just having a brain freeze on how how to set a default for this, which I assume will fix that. Any advice or guidance would be appreciated.
Jason_Mathison | 2024-06-03 02:28:49 UTC | #2
If the remote endpoint returns a non 2xx response then the data action will take the failure path, no matter how you configure it. In this case, if the ${input.contactId} doesn't have a hit in the contact list, then I would expect that you are getting a 404 "Not Found" response.
If this is a non-call architect flow then the response code from the remote endpoint will be available in the data action failure path. If this is a call flow then you will not have the response code available. Depending on your situation it might make sense to assume that a failure meant you got a 404.
There is an idea for getting the response code back to you in call flows: https://genesyscloud.ideas.aha.io/ideas/INB-I-1498
--Jason
system | 2024-07-04 02:29:21 UTC | #3
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 26549