Lloyd | 2019-06-27 08:14:37 UTC | #1
I have some string data stored in a data table in PureCloud. I've created a data action using "/api/v2/flows/datatables/--MyDatatableIdGuid--/rows" to retrieve the data, which returns the rows and keys successfully
[ { "pageSize": 25, "total": 2, "pageCount": 1, "pageNumber": 1, "entities.key": [ "1", "2" ] } ]
However I'm trying to get access to the row contents.
The documentation for the API call says I need to set showbrief to false to return the row contents.
I'm just not sure how to format set this in the request configuration
{ "requestUrlTemplate": "/api/v2/flows/datatables/--MyDatabaleIdGuid---/rows", "requestType": "GET", "headers": {}, "requestTemplate": "${input.rawRequest}" }
Any clues or pointers? Thanks
anon28066628 | 2019-06-27 13:14:16 UTC | #2
Hi Lloyd, according to the documentation 'showbrief' is a query string parameter. You'd need to add it to the URL:
"requestUrlTemplate": "/api/v2/flows/datatables/--MyDatabaleIdGuid---/rows&showbrief=false"
If you'd like to parameterize it, you can use a template field and include the bool value in your input schema:
"requestUrlTemplate": "/api/v2/flows/datatables/--MyDatabaleIdGuid---/rows&showbrief=${input.showbrief}"
GET /api/v2/flows/datatables/{datatableId}/rows
Lloyd | 2019-06-27 18:55:20 UTC | #3
Thanks for your quick reply. That is how I read the documentation too.
However when I tried that it returns a 404 error - But by removing the &showbrief-false it returns keys correctly (without full data) confirming the datatable exists and the Id is correct.
Here's my request:
{ "requestUrlTemplate": "/api/v2/flows/datatables/ --validDataTableGuid-- /rows&showbrief=false", "requestType": "GET", "headers": {}, "requestTemplate": "${input.rawRequest}" }
But here's my result (with ContextId if that helps)
{ "status": 404, "code": "not.found", "message": "The requested resource was not found.", "messageParams": {}, "contextId": "54cd5f40-d5a2-4f1a-8d17-42a057cbf1b0", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "status": 404, "code": "NOTFOUND", "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: {\"status\":404,\"code\":\"not found\",\"message\":\"HTTP 404 Not Found\",\"contextId\":\"71caacbf-fc25-40d1-8ad1-83e3ceba97c0\",\"details\":[],\"errors\":[]} [54cd5f40-d5a2-4f1a-8d17-42a057cbf1b0]", "messageParams": {}, "details": [], "errors": [] } ] }
Also tried with a specified key as well, incase I was at a too higher level, but same result. /api/v2/flows/datatables/--MyDatatableIdGuid---/rows/1 works /api/v2/flows/datatables/--MyDatatableIdGuid---/rows/1&showbrief=false fails
Lloyd
anon28066628 | 2019-06-27 20:40:45 UTC | #4
I'm not sure what the issue is... I'm able to retrieve the table with the following requestUrlTemplate:
{ "requestUrlTemplate": "https://api.mypurecloud.com/api/v2/flows/datatables/15a82bfa-09a9-460d-aabf-37b067027bbf/rows?showbrief=false", }
Have you tried the call in API Explorer? https://developer.mypurecloud.com/developer-tools/#/api-explorer
Side note: I'm not using a PureCloud Data Action, rather the general Web Services Data Action - that's why I'm using the full URL.
Lloyd | 2019-06-28 04:11:03 UTC | #5
Fantastic - Thank you.
I was using a PureCloud Action; So switched to general web services and now working as required.
Lloyd
anon28066628 | 2019-06-28 13:55:40 UTC | #6
Hi Lloyd, this confounded me until a colleague pointed this out in your original URI:
"/api/v2/flows/datatables/<GUID>/rows & showbrief=false"
The & should be ? - question mark begins a query string; ampersands are separators. The action should work as a general web service action or a PureCloud-specific action.
Lloyd | 2019-06-30 21:55:59 UTC | #7
Arrgh - Rookie mistake on my part!
Yup, confirming it works for both methods when I use the correct separator :slight_smile:
Thanks again L
anon28066628 | 2019-07-01 14:50:16 UTC | #8
Cool, thank you for the follow-up. Nice knowing all's right with the world, :stuckouttongue:
system | 2019-08-01 14:50:16 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: 5428