Handling of Object Arrays in Data Actions

Hi,

I am having trouble with a certain Web-API response not being what I expected.

For example : Pass the following response to Genesys Cloud

{
    "returnCode": "00",     
    "returnProgramID": "99999999",      
    "dataNumber": "002",        
    "target": [
        {
            "clientNo": "12345678901",
            "contractNo": "1234567890123456"
        },
        {
            "clientNo": "92345678901",
            "contractNo": "9234567890123456"
        }
    ]
};

When this is received in a Genesys Data Action, it would be expressed as follows.

{
    "contractNo": [
        "1234567890123456",
        "9234567890123456"
    ],
    "clientNo": [
        "12345678901",
        "92345678901"
    ],
    "returnProgramID": "99999999",
    "returnCode": "00",
    "dataNumber": "002",
}

Can you please advise why this is happening?
The settings for this Data Action are as follows -

Input Contract >

{
  "title": "PaymentAcceptanceInformationAPI",
  "type": "object",
  "properties": {
    "copeCode": {
      "type": "string"
    },
    "transactionId": {
      "type": "string"
    },
    "contractNo": {
      "type": "string"
    },
    "clientNo": {
      "type": "string"
    }
  },
  "additionalProperties": true
}

Output Contract >

{
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "returnCode": {
      "description": "returnCode",
      "type": "string"
    },
    "returnProgramID": {
      "description": "returnProgramID",
      "type": "string"
    },
    "dataNumber": {
      "description": "dataNumber",
      "type": "string"
    },
    "target": {
      "description": "target",
      "type": "array",
      "items": [
        {
          "title": "clientNo",
          "description": "clientNo",
          "type": "string"
        },
        {
          "title": "contractNo",
          "description": "contractNo",
          "type": "string"
        }
      ]
    }
  },
  "additionalProperties": true
}

Configuration(Responsee) >

{
  "translationMap": {
    "contractNo": "$.paymentAcceptanceInformation[*].contractNo",
    "clientNo": "$.paymentAcceptanceInformation[*].clientNo",
    "returnProgramID": "$.returnProgramID",
    "returnCode": "$.returnCode",
    "dataNumber": "$.dataNumber"
  },
  "translationMapDefaults": {},
  "successTemplate": "{\"returnCode\": ${returnCode},\"returnProgramID\": ${returnProgramID},\"dataNumber\": ${dataNumber},\"clientNo\": ${clientNo},\"contractNo\": ${contractNo}}"
}

Kind Regards,

If I understand what is going on, I think that you are saying that this is the response from the endpoint:

{
    "returnCode": "00",     
    "returnProgramID": "99999999",      
    "dataNumber": "002",        
    "target": [
        {
            "clientNo": "12345678901",
            "contractNo": "1234567890123456"
        },
        {
            "clientNo": "92345678901",
            "contractNo": "9234567890123456"
        }
    ]
}

And you want the data action to return exactly that structure. In that case, you can get rid of all of your translationMap entries and change the successTemplate to be the default configuration of

"successTemplate": "${rawResult}"

This default configuration means that the data action will return the response from the endpoint without any changes.

--Jason

Hi Jason_Mathison-san,

Thanks to you for your prompt reply and to Masaki-san for supporting it.

Your advice: "successTemplate":"${rawResult}" was already tried by me. Still the result did not change. Will I still get the response I expect if the response from the endpoint contains an object array?

Is there any room left for me to check next?

Regards,

I believe that I did test this out prior to sending you a response. Can you maybe show the output you are getting in each step in test mode to help me understand your problem? You could also open up a support ticket so that you can work with someone directly on this issue.

--Jason