Legacy Dev Forum Posts

 View Only

Sign Up

How to translate GET Reponse

  • 1.  How to translate GET Reponse

    Posted 06-05-2025 18:40

    Jan_Helgeson | 2018-02-14 23:44:32 UTC | #1

    I'm using Secure Data Actions to communicate between our IVR and Payment Gateway. One of the first things we call in flow is a Data Action to grab a ClientToken (sessionID) that we then pass with the other actions. I'm having trouble translating the response from the GET into a variable.

    The response I get from our endpoint is just a hash, which is the session ID for example: "e6616be8-7467-4009-948d-1235c05170f7"

    I'm trying to figure out how to setup the response configuration and Output Contract to take this value and put it into a String variable called "ClientToken"

    Output contract I have currently: { "$schema": "http://json-schema.org/draft-04/schema", "title": "Default User Action Schema", "description": "Default schema for a user action.", "type": "object", "properties": { "ClientToken": { "type": "string", "description": "Client Token used for payments" } }, "additionalProperties": true }

    For the response configuration I originally had just "successTemplate": "${rawResult} - which caused schema issues since the response is not an object.

    Is it possible to convert the raw response (hash) into an object? Or do I need to have my endpoint respond with a formatted object like {"ClientToken": "XXXXXX"}. Any help would be appreciated.


    Jason_Mathison | 2018-02-15 13:11:36 UTC | #2

    You should be able to set your successTemplate to something like "{\“ClientToken\”: \“${rawResult}\”}"

    You may need to play with it a bit in test mode, or on a site like https://www.freeformatter.com/json-escape.html to work out any kinks.


    Jan_Helgeson | 2018-02-15 15:57:43 UTC | #3

    Jason, I tried what you suggested, but now I'm getting a different error:

    { "status": 400, "code": "bad.request", "message": "Transform failed to process result using 'successTemplate' template due to error:'Unexpected character ('a' (code 97)): was expecting comma to separate Object entries\n at [Source: (String)\"{\"ClientToken\": \"\"ae72ab7c-fe2f-4b69-b156-01147e7aef37\"\"}\"; line: 1, column: 20]'\n Template:'{\"ClientToken\": \"${rawResult}\"}'.", "messageParams": {}, "contextId": "9d2e1323-19c8-44e1-bd39-e63832faa289", "details": [], "errors": [] }

    Not sure why, since there is only 1 entry.


    Jason_Mathison | 2018-02-15 16:11:31 UTC | #4

    The double quotes around this ““ae72ab7c-fe2f-4b69-b156-01147e7aef37"” seems suspect. Also, I don't know if this is a developer forum thing, but some of the quotes look like smart quotes.


    Jan_Helgeson | 2018-02-15 16:23:24 UTC | #5

    Yea, I looked closer at the quotes, and I realized the raw response I was getting was:

    "token"

    So the response already has quotes in it. I changed the template to: "successTemplate": "{\"ClientToken\": ${rawResult}}"

    Since I already had quotes, I didn't need to add them again. Got it working! Thanks for your help - that escape tool you linked is really helpful.


    system | 2018-03-18 16:23:26 UTC | #6

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