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

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.**

* Failed due to malformed requestUrlTemplate. Illegal character in path at index 105: https://api.mypurecloud.com.au/api/v2/flows/datatables/c3dcae56-7c7c-488a-825e-64ebda01f00c/rows/Heritage Payment Query?showbrief=false

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'

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,

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

1 Like

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

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.