sseelam | 2022-04-05 20:32:20 UTC | #1
Hi Team,
can you suggest how to resolve below issue? I have an endpoint which is called via data action and the response either returns a successful response(true/false) if success, and an error response if no data found in database. I am getting same response when called directly from postman.
I tried using translationMapDefaults to default value to False but no luck.
when there is no data, below is the error response: { "message": "The server encountered an unexpected condition which prevented it from fulfilling the request.", "code": "internal.server.error", "status": 500, "messageParams": {}, "contextId": "7b783ec2-b0ff-434a-aad2-b437d81af7d4", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service: {\"self\":\"https://xxxxx/PhoneContactable\",\"httpMethod\":\"POST\",\"errorMessage\":\"String index out of range: 3\",\"errorCode\":\"PLATFORM-800\",\"transactionId\":\"39C280FD-3486-4822-B794-97C31438DECA\"} [7b783ec2-b0ff-434a-aad2-b437d81af7d4]", "code": "INTERNALSERVER_ERROR", "status": 500, "messageParams": {}, "details": [], "errors": [] } ] }
Thank you
sseelam | 2022-04-05 20:38:43 UTC | #2
here is the Response template: { "translationMap": { "ContactMode": "profile.phones[*].contactModes[?(@=='AUTODIAL')]" }, "translationMapDefaults": { "ContactMode": "" }, "successTemplate": "{\r\n \"autoDialStatus\": \"#if(${successTemplateUtils.firstFromArray(${ContactMode})} == \"${esc.quote}AUTODIAL${esc.quote}\")true#{else}false#{end}\"\r\n}" }
Jason_Mathison | 2022-04-05 20:39:52 UTC | #3
If an endpoint returns a non 2xx response then the data action is going to return an error.
If this is an endpoint that your company controls you could ask to get a new endpoint that returns a 2xx with information if it worked or not in the body. You could also wrap this endpoint with an intermediary service or lambda, although those approaches are not great.
If you are using this inside of an architect flow you could assume that the data action taking the error path means that you didn't find what you were looking for.
Hope this gives you some ideas.
--Jason
sseelam | 2022-04-05 20:44:19 UTC | #4
Thank you Jason for prompt response. yes, this API was built in-house and controlled by my company. I am using this data action as a pre-call rule set so, records are just skipping with wrap-up message "ININ-OUTBOUND-RULE-ERROR-SKIPPED".
can you point me to a sample on how to create an intermediary service? I am pretty much new to GC.
Thanks in advance.
Jason_Mathison | 2022-04-05 20:53:43 UTC | #5
Ah, so this is a pre-call rule. I don't know what, if any, flexibility you have for error handling there.
By an intermediary service I literally mean a new web service (or AWS lambda) that your data action calls, that then calls your corporate web service and repackages the results to always return a 200 along with the response data that you need. I can't provide much more than that, although I am sure that our professional services organization could tackle this if you needed.
Since this is your companies web service I would probably ask them first if they can give you an API that you can use.
--Jason
sseelam | 2022-04-05 20:58:27 UTC | #6
understood. Thanks for the response.
system | 2022-05-06 20:59:00 UTC | #7
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: 14179