Hi all,
I am unable to parse the response of a data action. The response that I am getting from the API endpoint is:
{
"result": [
{
"number": "CS1743419",
"short_description": "Test Case from Genesys via API 2",
"sys_id": "58a77c433be79610b70f100864e45a28",
"state": "New",
"work_notes": "2025-02-10 07:14:33 - Animesh Mulasi (Work notes)\nNotes Updated\n\n",
"assigned_to": "Animesh Mulasi"
},
{
"number": "CS1743418",
"short_description": "Test Case from Genesys via API 1",
"sys_id": "5e97bc4733271a10fa7c3542cd5c7b4c",
"state": "New",
"work_notes": "2025-02-11 02:25:12 - Animesh Mulasi (Work notes)\nWork notes update 1\n\n",
"assigned_to": "Animesh Mulasi"
},
{
"number": "CS1743421",
"short_description": "Test Case from Genesys via API 4",
"sys_id": "71a7bc433be79610b70f100864e45a04",
"state": "New",
"work_notes": "2025-02-11 02:26:21 - Animesh Mulasi (Work notes)\nWork notes update 1\n\n",
"assigned_to": "Animesh Mulasi"
}
]
}
I want to parse this data which is an array of objects. My output contracts are:
{
"title": "Output",
"type": "object",
"additionalProperties": true,
"properties": {
"result": {
"type": "array",
"items": {
"title": "Case",
"type": "object",
"additionalProperties": true,
"properties": {
"number": {
"type": "string"
},
"work_notes": {
"type": "string"
},
"short_description": {
"type": "string"
},
"sys_id": {
"type": "string"
},
"state": {
"type": "string"
}
}
}
}
}
}
My response configuration is:
{
"translationMap": {
"number": "$.result[*].number",
"short_description": "$.result[*].short_description",
"sys_id": "$.result[*].sys_id",
"state": "$.result[*].state",
"work_notes": "$.result[*].work_notes"
},
"translationMapDefaults": {},
"successTemplate": "{\n \"Case.number\": ${number},\n \"Case.work_notes\": ${work_notes},\n \"Case.short_description\": ${short_description},\n \"Case.sys_id\": ${sys_id},\n \"Case.state\": ${state}}"
}
This action is running successfully but I am not able to get the data in output contracts. Please see the attached screenshot.
I configured the output contract based on a forum post which I came across earlier:
Could anyone please help?