Data Action - Update DataTable

Dear PureCloud Developers

Hope this message finds you well.

Please may I ask for your assistance with the PUT data action to update a data table row?

I am wishing to use the PUT API https://api.{{environment}}/api/v2/flows/datatables/{{datatableId}}/rows/{{rowId}} and update the row of a table from the architect.

This is my second data action, I invite all of your feedback please to help me be better.

The following data action has been implemented, and returns thefollowing error (note: this user has full access to PC).

{
  "status": 403,
  "code": "not.authorized",
  "message": "You are not authorized to perform the requested action.",
  "messageParams": {},
  "contextId": "a7f04fd9-63b0-45db-abe7-2579b033af67",
  "details": [],
  "errors": [
    {
      "status": 403,
      "code": "NOT_AUTHORIZED",
      "message": "REST call for action execute failed. Message:Request to backend service failed.  Response from web service: {\"status\":403,\"code\":\"missing.any.permissions\",\"message\":\"Unable to perform the requested action. You must have at least one of the following permissions assigned: [architect:datatable:edit]\"} [a7f04fd9-63b0-45db-abe7-2579b033af67] [a7f04fd9-63b0-45db-abe7-2579b033af67]",
      "messageParams": {},
      "details": [],
      "errors": []
    }
  ]
}

Please kindly find below the Data Action input/output.

Input
{
"$schema": "..",
"title": "Update Table",
"description": "using this to update the table",
"type": "object",
"required": [
"datatableId",
"rowId",
"Score"
],
"properties": {
"datatableId": {
"description": "dataTableId",
"type": "string"
},
"Score": {
"description": "Score",
"type": "integer"
},
"rowId": {
"description": "Which key to update",
"type": "integer"
}
}
}

Output
{
"$schema": "..",
"title": "Update the data table",
"description": "Table updated",
"properties": {}
}

Request
{
"requestUrlTemplate": "/api/v2/flows/datatables/{input.datatableId}/rows/{input.rowId}",
"requestType": "PUT",
"headers": {
"Transfer-Encoding": "buffered",
"UserAgent": "PureCloudIntegrations/1.0",
"Content-Type": "application/json"
},
"requestTemplate": "{"Score": "${input.Score}"}"
}

Response
{
"translationMap": {},
"successTemplate": "${rawResult}"
}

Per the error message, the client credentials being used are missing the permission architect:datatable:edit. Be sure that the one of the roles assigned to the client credentials oauth client grants this permisson; admin does not grant all permissions by default.

Dear Tim

Hope you are well, and thank you very much for your reply.

When testing the api call with Postman or through the PureCloud Dev tool, I am able to update the data table. When using it in the data action, it doesn't seem to be authenticating anywhere, hence the no permissions error.

Are we able to use PUT/POST from PureCloud Data Actions to the DataTable please?

The reason for trying it was because we wanted to update a data table row with input from the IVR for PostCall Survey results. Much appreciated if you had any ideas or recommendations for this?

I checked the context id in our logs, and authentication token was added to the request by the action. Public API gets executes the request on correctional id 1bf3f41d-5309-48f3-9599-a3c0c39b4377.
The permissions that Public API pulls for the the user do not contain any architect permissions.
These were the permissions found for oauth client id (user) 1c0418bc-819c-4f38-9f73-1cb378cddd55:

rolenames: [PureCloud Supervisor, admin] permissions: [acdvideo:session:view, admin, alerting:alert:add,view,edit,delete, alerting:rule:add,view,edit,delete, analytics:conversationAggregate:view, analytics:conversationDetail:view, analytics:conversationProperties:index, analytics:evaluationAggregate:view, analytics:insightConfigurations:view, analytics:queueObservation:view, analytics:userAggregate:view, analytics:userDetail:view, analytics:userObservation:view, analytics:viewConfigurations:view,edit, attributes:attribute:add,view,edit,delete, authorization:audit:view, authorization:grant:add,view,delete, authorization:orgTrustee:add,view,edit,delete, authorization:orgTrusteeGroup:add,view,edit,delete, authorization:orgTrusteeUser:add,view,edit,delete, authorization:orgTrustor:view,delete, authorization:role:add,view,edit,delete, billing:subscription:add,view, bridge:actions:add,view,edit,delete,execute, bridge:notification:add,view, bridge:plugin:add,call,view,edit,delete, bridge:pluginType:add,edit, bridge:publisher:view, bridge:server:add,view,edit,delete, bridge:serverFile:add,request,view, chat:file:delete, cobrowse:deployment:manage, cobrowse:session:monitor,replay, content_management_admin, content_management_user, conversation:call:add,record,monitor, conversation:callback:create, conversation:communication:disconnect,view,transfer, conversation:conference:add, conversation:participant:wrapup, conversation:recording:pause, directory:user:add,view,edit,delete, documents:audit:search, employee, externalContacts:contact:add,view,edit,delete, externalContacts:conversation:associate, externalContacts:externalEntity:import, externalContacts:externalOrganization:add,view,edit,delete, field_administration, group_administration, integration_config_administration, integrations:action:add,view,edit,execute,delete, integrations:integration:add,view,edit,delete, location_administration, person_administration, presence:presenceDefinition:add,edit,delete, quality:keywordset:view, recording:annotation:add,viewAudit,view,edit,delete, recording:callRecording:recordDualChannel, recording:encryptionKey:view,edit, recording:media:record, recording:orphanRecording:view,edit,delete, recording:recording:viewAudit,download,view,restore,editRetention,delete, recording:retentionPolicy:add,view,edit,delete, recording:screenRecording:viewAudit,view,stop,restore,editRetention, recording:settings:editScreenRecordings, reporting:acd:view, reporting:interactions:view, reporting:outbound:view, reporting:quality:view, role_manager, routing:agent:onqueue, routing:email:manage, routing:queue:view,edit,join, routing:skill:assign, routing:skill:assign,manage, routing:utilization:view,manage, routing:wrapupCode:view, telephony:phone:assign, telephony:plugin:all, telephony:sites:view, ui:supervisorAgentDetails:view, ui:supervisorDashboard:view, ui:supervisorPerformance:view, ui:supervisorQueueDetails:view, user_administration, voicemail:acdVoicemail:view,delete]

When your PureCloud Data Action integration was created there is a section for credentials (Client ID and Client Secret). Those credentials are granted one or more roles in the integrations->OAuth configuration page. You need to ensure that the credential includes a role that has the architect:datatable:edit permission. While the credential has PureCloud Supervisor and admin roles, those roles don't actually include all possible permissions.

Dear Jason and Greg

Hope you are well, and thank you very much for your feedback.

Indeed, the PureCloud Data Action OAuth permissions needed reviewing, they haven't been updated since the Datatable was released, and I had missed that completely.

Thank you very much for your help.

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