owada | 2020-04-27 13:57:19 UTC | #1
Hello everyone. I want to Num of Call Waiting in Queue using PureCloud data action. I created the following syntax, but I am getting the Status: 400 error.
・Enter contract { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "queueId" ], "properties": { "queueId": { "type": "string" } } }
・Contract output { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "NumOfWaitingInQueue": { "type": "integer" } } }
・Request
{ "requestUrlTemplate": "/api/v2/analytics/queues/observations/query", "requestType": "POST", "headers": { "UserAgent": "PureCloudIntegrations/1.0", "Content-Type": "application/json" }, "requestTemplate": "{\"filter\": {\"type\": \"or\", \"predicates\": [{\"type\": \"dimension\",\"dimension\": \"queueId\",\"operator\": \"matches\",\"value\": \"${input.queueId}\" }]}, \"metrics\": [\"oWaiting\"]}" }
・Response
{ "translationMap": { "count": "$.results[0].data[0].stats.count" }, "translationMapDefaults": {}, "successTemplate": "{\"NumOfWaitingInQueue\":${count}}" }
When I run the action test, I get the following error:
- Execute: The request could not be understood by the server due to malformed syntax.
REST call for action execute failed. Message:Request to backend service failed. Response from web service: {"message":"invalid dimension value","code":"bad.request","status":400,"messageParams":{},"contextId":"0bc4282f-fe21-428b-b5db-304710b91a68","details":[],"errors":[]} [7b0deaf2-4411-452f-ae59-940c556a9400]
{ "message": "The request could not be understood by the server due to malformed syntax.", "code": "bad.request", "status": 400, "messageParams": {}, "contextId": "7b0deaf2-4411-452f-ae59-940c556a9400", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: {\"message\":\"invalid dimension value\",\"code\":\"bad.request\",\"status\":400,\"messageParams\":{},\"contextId\":\"0bc4282f-fe21-428b-b5db-304710b91a68\",\"details\":[],\"errors\":[]} [7b0deaf2-4411-452f-ae59-940c556a9400]", "code": "BADREQUEST", "status": 400, "messageParams": {}, "details": [], "errors": [] } ] }
The Test passes until step 7 but fails at Execute with Status : 400. I can see the URL template getting resolved as expected. How can I resolve this error?
Jason_Mathison | 2020-04-27 15:06:24 UTC | #2
It appears that the issue is that you are passing in "task" as the queueId, when it is expecting the GUID for your Queue. You can get the ID for the queue by navigating to the administration page for that queue, and copying the ID from the URL:
8142fe7a-f125-4c84-9406-d7dfc02dc3ee is the ID for this queue:
/directory/#/admin/admin/organization/_queuesV2/8142fe7a-f125-4c84-9406-d7dfc02dc3ee/routing
Another way is to put your browser in developer mode and see the request that the Analytics Query builder sends out when you test your query.
--Jason
owada | 2020-04-28 11:54:04 UTC | #3
Thank you for your answer. I was able to solve the problem.
system | 2020-05-29 11:54:05 UTC | #4
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: 7645