Legacy Dev Forum Posts

 View Only

Sign Up

Data Action Help + Translation Map Default Help Please

  • 1.  Data Action Help + Translation Map Default Help Please

    Posted 06-05-2025 18:41

    Samuel_Polgar | 2018-12-02 00:58:03 UTC | #1

    Dear PureCloud Developers

    Hoping you could shed some light on the following data action, and implementing the translation map defaults as per article: https://help.mypurecloud.com/articles/response-configuration-data-actions/

    I have two possible responses from the data action, success if success and error if error.

    Success { "data": [ { "message": "success" } ] }

    Error example: { "error": "body: creationTimeStamp: not a datetime-only" }

    A successful message uses the following TranslationMap and returns the message correctly.

    { "translationMap": { "messageValue": "$.data[0].message" }, "translationMapDefaults": {}, "successTemplate": "{ \"message\": ${messageValue}" }

    I tried to send the error message back by itself using the following Translation Map

    { "translationMap": { "errorValue": "$.error" }, "translationMapDefaults": {}, "successTemplate": "{ \"error\": ${errorValue}" }

    and received the below error message

    { "status": 400, "code": "bad.request", "message": "The request could not be understood by the server due to malformed syntax.", "messageParams": {}, "contextId": "d9d1f7b9-99fe-4abe-b036-a9106ec27a98", "details": [], "errors": [ { "status": 400, "code": "BAD_REQUEST", "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: {\"error\":\"body: creationTimeStamp: not a datetime-only\"} [d9d1f7b9-99fe-4abe-b036-a9106ec27a98]", "messageParams": {}, "details": [], "errors": [] } ] }

    My apologies if this is not very clear, any assistance would be greatly appreciated if you can see what is wrong.

    In Addition, because the response from the data action either returns a successful response if success, and an error response if error, I was hoping to use translationMapDefaults in either case.

    I was using the default from the website in the data action for example:

    "translationMapDefaults": { "sourceValue": "\"UNKNOWN"\" }

    and I received the parsing error in the data action

    Expected ',' instead of '\'

    Once again, any assistance to help shed some light on the translationMapDefaults would be extremely appreciated. From my current understanding of the data actions, this is what I was thinking of doing to implement it. Please let me know if there is a better way to do so!


    Samuel_Polgar | 2018-12-03 05:40:37 UTC | #2

    Dear PureCloud Developers

    We figured a work around for this, and It may help to post the solution;

    1. TranslationMapDefaults: worked when it was "\"UNKNOWN\"" Rather than "\"UNKNOWN"\"
    2. The error was in the API header not the body. PureCloud wasn't parsing the response successfully because it was a failed API call all together.

    If you see anything else that could be improved please let me know.


    patrick.barry | 2018-12-06 21:04:24 UTC | #3

    Thanks for the follow up on this. As you discovered, your workaround is the correct way to escape the quotes. We are updating our docs to reflect the correction. Thanks again!


    Samuel_Polgar | 2018-12-06 21:58:35 UTC | #4

    Hello Patrick

    Thank you very much, looking forward to the updated documentation.


    system | 2019-01-06 21:57:31 UTC | #5

    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: 4086