Legacy Dev Forum Posts

 View Only

Sign Up

Request URL Template for /api/v2/flows/datatables/{datatableId}/rows/{rowId}

  • 1.  Request URL Template for /api/v2/flows/datatables/{datatableId}/rows/{rowId}

    Posted 06-05-2025 19:21

    Aurelien_Plancque | 2020-10-16 00:51:22 UTC | #1

    Hi all,

    I am trying to do something relatively simple: create a PureCloud dataction to look up for a row in a data table. the use case is to look up from a Script.

    The problem is that my rowId can contain spaces. I can totally do the following from API Explorer: GET /api/v2/flows/datatables/c3dcae56-7c7c-488a-825e-64ebda01f00c/rows/Heritage Payment Query?showbrief=false

    However, the same request from a Data Actions fails:

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

    Is there anything obvious that I am not seeing there? I have tried URL escaping the spaces but then of course the row is not found...

    edit: $esc.url() seems to escape space with '+' rather than '%20'


    Jerome.Saint-Marc | 2020-10-16 07:58:43 UTC | #2

    Hello,

    I can't think of a way to escape space with '%20' in a simple way - I mean with a single velocity macro. It doesn't mean there is none - I haven't used escaping in Data Action a lot so far.

    What I could think of - at least to manage space character - was to do the following. Assuming tableId and rowId are my parameter names in the Input Contract. In my Configuration Request, I have set requestUrlTemplate the following way:

    "requestUrlTemplate": "#set ($modRowId = $input.rowId.replace(\" \", \"%20\"))/api/v2/flows/datatables/${input.tableId}/rows/${modRowId}?showbrief=false",

    If there are no easier methods to do this, could you request this as a new feature (macro for URI encoding in Data Action - sharing this use case) at https://genesyscloud.ideas.aha.io/ ?

    Regards,


    Jason_Mathison | 2020-10-16 17:19:47 UTC | #3

    Hi All,

    I created internal ticket BPIVR-2152 for this issue. It appears that the esc.url method is for HTML form encoding, not the URL. We need to look into it further.

    Jerome's example could be simplified a little bit by getting rid of the set. This is what I had in the simple UI mode request template:

    /api/v2/flows/datatables/c3dcae56-7c7c-488a-825e-64ebda01f00a/rows/$input.rowName.replace(" ", "%20")?showbrief=false

    --Jason


    Aurelien_Plancque | 2020-10-19 02:42:38 UTC | #4

    @Jason_Mathison, you are a genius. It works perfectly, I had no idea you could actually do that, so thanks for the example.


    system | 2020-11-19 02:42:43 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: 9092