Elia_Diez | 2019-11-20 19:59:53 UTC | #1
Hello, I'm generating a data action to perform a test on data tables, and when I try to put, I get this error, can you help me?
{ "status": 400, "code": "invalid.credentials", "entityName": "pureCloudOAuthClient", "message": "There was an issue validating the credentials.", "messageParams": {}, "contextId": "f2f835b7-0076-4581-9db8-0f1e09a6595d", "details": [ { "errorCode": "ACTION.AUTHENTICATION" } ], "errors": [ { "status": 400, "code": "INVALIDCREDENTIALS", "message": "Request to backend service failed. Response from web service: {\"error\":\"invalidclient\",\"description\":\"authentication failed\",\"error_description\":\"authentication failed\"}\n [f2f835b7-0076-4581-9db8-0f1e09a6595d]", "messageParams": {}, "details": [], "errors": [] } ] }
mostrar/ocultar
Operaciones
{ "status": 400, "code": "invalid.credentials", "entityName": "pureCloudOAuthClient", "message": "There was an issue validating the credentials.", "messageParams": {}, "contextId": "f2f835b7-0076-4581-9db8-0f1e09a6595d", "details": [ { "errorCode": "ACTION.AUTHENTICATION" } ], "errors": [ { "status": 400, "code": "INVALIDCREDENTIALS", "message": "Request to backend service failed. Response from web service: {\"error\":\"invalidclient\",\"description\":\"authentication failed\",\"error_description\":\"authentication failed\"}\n [f2f835b7-0076-4581-9db8-0f1e09a6595d]", "messageParams": {}, "details": [], "errors": [] } ] }
Elia_Diez | 2019-11-20 15:35:55 UTC | #2
Response Headers
HTTP/1.1 401 Unauthorized Content-Type: application/json Content-Length: 125 Connection: keep-alive Date: Wed, 20 Nov 2019 15:00:18 GMT ININ-Correlation-Id: Strict-Transport-Security: max-age=600; includeSubDomains Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache Expires: 0 X-Cache: Error from cloudfront Via: 1.1 4c3936cc7f5f36d3966cb34ebcbf91a7.cloudfront.net (CloudFront) X-Amz-Cf-Pop: IAD79-C1 X-Amz-Cf-Id: gnC-pw54m18VdQcE8dekGXNM6SDQCEfzSPC0cm4UXJHJXPVF2ksYoQ==
Response Body
{"status":401,"code":"authentication.required","message":"No authentication bearer token specified in authorization header."}
tim.smith | 2019-11-20 20:02:30 UTC | #3
As the error message indicates, the request was made without specifying the authorization header. See About the PureCloud data actions integration for documentation on setting up PureCloud Data Actions, including how to configure the credentials.
Elia_Diez | 2019-11-21 10:25:53 UTC | #4
Hello, after looking at the documentation, and making changes I still give this error, I'm doing from the purecloud data actions, a data action to update (PUT) the data tables internally. It gives me the following error.
{ "status": 400, "code": "bad.request", "message": "The request could not be understood by the server due to malformed syntax.", "messageParams": {}, "contextId": "5d9cd902-f932-4179-a82d-232462de860e", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "status": 400, "code": "BADREQUEST", "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: {\"status\":400,\"code\":\"flows.datatables.schema.exception\",\"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': 'id_pedido',\\n 'type': 'string'}\\n\\nOn instance['key']:\\n ''\",\"messageParams\":{},\"contextId\":\"0299823f-d65e-4fd9-9c40-463724f45a13\",\"details\":[],\"errors\":[]} [5d9cd902-f932-4179-a82d-232462de860e]", "messageParams": {}, "details": [], "errors": [] } ] }
My Configuration data actions.
{ "requestUrlTemplate": "/api/v2/flows/datatables/datatableid/rows/rowid", "requestType": "PUT", "headers": { "UserAgent": "PureCloudIntegrations/1.0", "Content-Type": "application/json", "Transfer-Encoding": "buffered" }, "requestTemplate": "\"requestTemplate\": {'idpedido': ${input.idpedido}" }
{ "translationMap": { "idpedido": "$.idpedido", "idcliente": "$.idcliente" }, "translationMapDefaults": {}, "successTemplate": "{\n \"idpedido\": ${idpedido},\n \"idcliente\" : ${idcliente},\n}" }
anon28066628 | 2019-11-21 15:11:30 UTC | #5
What does your request schema look like? You reference ${input.id_pedido} in the template, but it may not get passed through. Based on this:
Failed validating 'minLength' in schema['properties']['key'] 'minLength': 1
I'd guess your action is sending an empty string. Please check that id_pedido is defined as an input (case-sensitive) in your input schema.
Elia_Diez | 2019-11-21 15:14:15 UTC | #6
Hello, I enclose my data action. <a class="attachment" href="/forum/uploads/db6296/original/2X/1/131ca3773d2f396d691293bada484d466dd4b565.json">PruebasDemo-20191121161317.custom.json</a> (2.0 KB)
anon28066628 | 2019-11-21 16:13:16 UTC | #7
"id_pedido": { "description": "The user ID.", "type": "integer" },
Looking at your input schema, are you sure your table id is an integer and not a string? Can you try it with a string?
tim.smith | 2019-11-21 16:31:14 UTC | #8
Also, I'd recommending building a working request before configuring the data action so you can isolate troubleshooting each part. You can test making the request using the dev tools https://developer.mypurecloud.com/developer-tools/#/api-explorer
Elia_Diez | 2019-11-22 12:24:45 UTC | #9
Hello, I've already done tests, see that the data is poorly structured?
tim.smith | 2019-11-22 15:23:57 UTC | #10
I'm not sure what you mean by "poorly structured". It should be returning requests structured in accordance with the documentation for the endpoint.
Jason_Mathison | 2019-11-22 18:48:16 UTC | #11
Elia_Diez,
It appears that the issue is that your data table is expecting you to include a ''id_pedido' value in your put of type string with a length between 1 and 256 characters. I would assume that means that you are currently either sending an empty string or not including that variable at all in your PUT body.
--Jason
Elia_Diez | 2019-11-25 10:19:07 UTC | #12
Hi, when I make a change to the incoming configuration, I get the following error. { "requestUrlTemplate": "/api/v2/flows/datatables/${input.datatableId}/rows/${input.entrantes}", "requestType": "PUT", "headers": { "UserAgent": "PureCloudIntegrations/1.0", "Content-Type": "application/json", "Transfer-Encoding": "buffered" }, "requestTemplate": {"nombre": {input.nombre}, "entrantes": {input.entrantes}"} }
The error is: Bad string
"requestTemplate": {"nombre": "{input.nombre}, "entrantes": {input.entrantes}"}
Error: Expected: ' , ' instead of: 'e'
<a class="attachment" href="/forum/uploads/db6296/original/2X/1/128ee03de96cf1089870588161fdf0f9d252feb9.json">pruebasdemo1-20191125110437.custom.json</a> (1.5 KB)
Jason_Mathison | 2019-11-25 14:20:16 UTC | #13
The escaping of the quotes on the request template is wrong. The easiest way to get this right would be to copy
` {"nombre": {input.nombre}, "entrantes": {input.entrantes}"}`
and paste it into the request template with the UI in simple mode. The complicated way is to take care of putting a \ in front of all of the quotes in the middle, ending up with something like
` "requestTemplate": "{\"nombre\": {input.nombre}, \"entrantes\": {input.entrantes}\"}"`
if you are working in JSON mode.
--Jason
Elia_Diez | 2019-11-25 14:18:53 UTC | #14
Jason_Mathison, post:13, topic:6522
"requestTemplate": "{"nombre": {input.nombre}, "entrantes": {input.entrantes}"}"
The error:
Jason_Mathison | 2019-11-25 14:21:24 UTC | #15
I updated my earlier post, please try again.
Elia_Diez | 2019-11-25 14:43:36 UTC | #16
Thnx.
When using the api explorer tool from there I can modify the row of data tables and I can update it but I can't make it work from the data action...
I still get this error when trying to update the data table. { "status": 400, "code": "bad.request", "message": "The request could not be understood by the server due to malformed syntax.", "messageParams": {}, "contextId": "5e0f2291-a41a-4c36-9285-aa280f04818a", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "status": 400, "code": "BADREQUEST", "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: {\"status\":400,\"code\":\"bad.request\",\"message\":\"The request could not be understood by the server due to malformed syntax.\",\"contextId\":\"13b22c2a-1b6a-4f0e-b594-8d6499a2bd88\",\"details\":[],\"errors\":[]} [5e0f2291-a41a-4c36-9285-aa280f04818a]", "messageParams": {}, "details": [], "errors": [] } ] }
You can review it by context-id??
Regards,
Jason_Mathison | 2019-11-25 14:44:05 UTC | #17
Please post a screenshot of it working in API explorer and a screenshot of test mode that has " Resolve request body template" expanded so we can compare what is being included in the body of the request.
Elia_Diez | 2019-11-25 14:49:19 UTC | #18
 |
 |
 |
 |
 |
 |
Jason_Mathison | 2019-11-25 14:57:59 UTC | #19
You have examples of both PUTs and GETs in this thread. Are both still failing, or is the GET route working now?
The failure you posted 25 minutes ago failed because the data action was sending invalid JSON to the Data Table endpoint. You are going to need to look at the "Resolve request body template" section of the test mode output to figure out what is going wrong there.
Elia_Diez | 2019-11-25 15:02:41 UTC | #20
If I do not return get data, only returns the row, but if I do put gives that error.
Jason_Mathison | 2019-11-25 15:08:17 UTC | #21
I am not sure what is going wrong. Please open up a case with Customer Care to troubleshoot this issue.
--Jason
Elia_Diez | 2019-11-27 13:30:19 UTC | #23
I figured it out, you can close up. Thank you
Jason_Mathison | 2019-12-02 14:37:53 UTC | #24
Can you share what you fixed? Is there anything that could be changed to make troubleshooting issues like this easier?
Elia_Diez | 2019-12-04 12:40:45 UTC | #25
Hello,
The problem was when you declare a string or a whole number the configuration has to be different.
Example String: \"nombre\": \"${input.nombre}\" Example integer: \"nuevopedido\": ${input.nuevopedido}
Jason_Mathison | 2019-12-04 14:30:53 UTC | #26
I have made those sorts of mistakes numerous times, I'm glad that you were able to get it working!
--Jason
system | 2020-01-04 14:30:55 UTC | #27
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: 6522