Hi All,
I am trying to use the number of "on queue" agents to make routing decisions in Architect. I have seen various posts regarding this and also can test the query in the developer tools which works using this query:
"
GET /api/v2/routing/queues/8e7d3e9f-8a8b-44e7-ae8c-84e9e4af3a23/users?presence=On%20Queue"
However when I try various code and in the data action I get various errors, for example if I use this previously posted code:
Input Contract:
{
"title": "Get Number of Agents Logged Into Queue Request",
"description": "A user ID-based request",
"type": "object",
"required": [
"QueueID"
],
"properties": {
"QueueID": {
"type": "string",
"description": "The Queue ID."
}
}
}
Output Contract:
{
"title": "Get User Routing Status Response",
"description": "Agents logged into queue.",
"type": "object",
"required": [
"Agents Logged Into Queue"
],
"properties": {
"Agents Logged Into Queue": {
"description": "Agents logged into queue. A value > 0 does not guarantee that an interaction sent to this queue will be answered.",
"type": "number",
"title": "Agents"
}
}
}
Request:
{
"requestUrlTemplate": "/api/v2/routing/queues/${input.QueueID}/users?presence=esc.url('On Queue')", "requestType": "GET", "headers": { "ContactID": "PureCloudIntegrations/1.0", "Content-Type": "application/x-www-form-urlencoded" }, "requestTemplate": "{input.rawRequest}"
}
Response:
{
"translationMap": {
"Agents_Logged_Into_Queue": ".total" }, "translationMapDefaults": {}, "successTemplate": "{ "Agents Logged Into Queue": {Agents_Logged_Into_Queue} }"
}"
I get this response:
{
"message": "The request could not be understood by the server due to malformed syntax.",
"code": "bad.request",
"status": 400,
"messageParams": {},
"contextId": "1d617fad-9b91-4582-b998-e640e39e29d2",
"details": [
{
"errorCode": "ACTION.PROCESSING"
}
],
"errors": [
{
"message": "Failed due to malformed requestUrlTemplate. Illegal character in query at index 112: https://api.mypurecloud.ie/api/v2/routing/queues/8e7d3e9f-8a8b-44e7-ae8c-84e9e4af3a23/users?presence=esc.url('On Queue')",
"code": "BAD_REQUEST",
"status": 400,
"messageParams": {},
"details": [],
"errors": []
}
]
}
If I change the request to match the previous test I was using in the developer tools, it returns this:
{
"message": "Transform failed to process result using 'successTemplate' template due to error:'Unexpected character ('A' (code 65)): was expecting double-quote to start field name\n at [Source: (String)"{ "Agents Logged Into Queue": {Agents_Logged_Into_Queue} }"; line: 1, column: 33]'\n Template:'{ "Agents Logged Into Queue": {Agents_Logged_Into_Queue} }'.",
"code": "bad.request",
"status": 400,
"messageParams": {},
"contextId": "50e2e081-b6d9-4fbe-995b-f0d1e05a4f48",
"details": [
{
"errorCode": "ACTION.PROCESSING"
}
],
"errors": []
}
I am very new to JSON, so any advise is greatly appreciated!
Thanks Luke