Legacy Dev Forum Posts

 View Only

Sign Up

Updating data tables with data actions

  • 1.  Updating data tables with data actions

    Posted 06-05-2025 18:45

    HanumanthaRao_Muvva | 2024-04-29 15:36:44 UTC | #1

    Hi, I am trying to create data action to update data table.

    I followed Help updating data table via Data Action - Data Actions - Genesys Cloud Developer Forum and created a da table with two columns and it worked. when I created another data table with four columns and modified the data action its giving below error. can some one provide guidance on what mistake I am doing here.

    { "name": "Update DataTable - Exported 2024-04-29 @ 20:55", "integrationType": "purecloud-data-actions", "actionType": "custom", "config": { "request": { "requestUrlTemplate": "/api/v2/flows/datatables/datatableid/rows", "requestType": "POST", "headers": { "Content-Type": "application/json" }, "requestTemplate": "{\n \"InteractionID\": ${input.InteractionID},\n \"UserID\": ${input.UserID},\n \"UserName\": ${input.UserName},\n \"Queue\": ${input.Queue}}" }, "response": { "translationMap": { "InteractionID": "$.[InteractionID]", "UserID": "$.[UserID]", "UserName": "$.[UserName]", "Queue": "$.[Queue]" }, "translationMapDefaults": {}, "successTemplate": "{\"InteractionID\": ${input.InteractionID},\"UserID\": ${input.UserID},\"UserName\": ${input.UserName},\"Queue\": ${input.Queue}}" } }, "contract": { "input": { "inputSchema": { "title": "Interaction Details", "type": "object", "properties": { "InteractionID": { "type": "string" }, "UserID": { "type": "string" }, "UserName": { "type": "string" }, "Queue": { "type": "string" } }, "additionalProperties": true } }, "output": { "successSchema": { "title": "Interaction Details", "type": "object", "properties": { "InteractionID": { "type": "string" }, "UserID": { "type": "string" }, "UserName": { "type": "string" }, "Queue": { "type": "string" } }, "additionalProperties": true } } }, "secure": false }

    Error Message: Execute: The request could not be understood by the server due to malformed syntax.

    • REST call for action execute failed. Message: Request to backend service failed. Response from web service: {"message":"'' is too short\n\nFailed validating 'minLength' in schema['properties']['key']:\n {'$id': '/properties/key',\n 'displayOrder': 0,\n 'maxLength': 256,\n 'minLength': 1,\n 'title': 'InteractionID',\n 'type': 'string'}\n\nOn instance['key']:\n ''","code":"flows.datatables.schema.exception","status":400,"messageParams":{},"contextId":"datatableid","details":[],"errors":[]} [f221f1ae-b9d6-494e-9ec5-fa05877b8fb5]

    SimonBrown | 2024-04-29 15:56:08 UTC | #2

    Can't read those json templates in that format.

    Checks: You supplied the Key field, it has to be provided. You populated ALL the fields with current values, if you not modifying them.

    Your URL looks to be missing the rowId and shows as POST, when its a PUT?

    Sample from mock of mine


    HanumanthaRao_Muvva | 2024-04-29 16:01:17 UTC | #3

    Hi @SimonBrown Type POST is correct.

    I am using POST /api/v2/flows/datatables/{datatableId}/rows

    Below is working copy of mine, when made a small change its not working(that is where I am not able to identify my mistake.

    { "requestUrlTemplate": "/api/v2/flows/datatables/datatableid/rows", "requestType": "POST", "headers": { "Content-Type": "application/json" }, "requestTemplate": "{\n \"Key\": ${input.Key},\n \"Text\": ${input.Text}}" }


    SimonBrown | 2024-04-29 16:10:59 UTC | #4

    You said updating rows, that's PUT operation. Post is for creating new rows.

    Not tried the POST version myself. May get chance to have a quick test and reply


    SimonBrown | 2024-04-29 16:23:10 UTC | #5

    Ok. Just did through API explorer fine.

    I would recommend you make the JSON body up in the Request body. Remember the "KEY" field is for the ID field you have, which could be called something completely different. The rest of the fields need to match and remember they are case sensitive.

    Below is one I just did for my datatable test

    { "Integer": 0, "Description": "Test POST entry", "Decimal": 1.12, "Boolean": true, "String2": "String 2 value", "key": "Simon", "String1": "String 1 value" }

    For data table that has schema


    HanumanthaRao_Muvva | 2024-04-29 17:32:16 UTC | #6

    Thank you @SimonBrown

    Key field is what i missed. In my example as I named 'key' as 'InteractionID' I am using 'InteractionID' as field value instead of 'Key'.

    Thank you for your quick assistance on this !


    HanumanthaRao_Muvva | 2024-04-30 12:59:32 UTC | #7

    Hi @SimonBrown ,

    I am getting failure when I am using this data action in Architect flow. could you suggest what might causing this.

    when I am passing input as 'Literal' (hard coded entry) it is working, when using variable, its filing. also I can see Flow.conversationId is getting value and able to print it, however data table update is failing.

    Thank you !

    when I tried some other data action( getting user presence ) in architect flow, it is working as expected.


    HanumanthaRao_Muvva | 2024-04-30 14:13:50 UTC | #8

    Hi Simon,

    never mind, this got fixed after correcting the syntax of request template.

    Thank you !


    system | 2024-05-31 14:13:52 UTC | #9

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