I'm trying to create a data action because Architect doesn't expose calls in queue (or wait time). I have worked out wait time, but I'm having trouble creating and importing my data Action json for calls in queue.
Here is my working API call...
# /api/v2/analytics/queues/observations/query
body:
{
"filter": {
"type": "and",
"predicates": [
{
"type": "dimension",
"dimension": "queueId",
"operator": "matches",
"value": "e0a8ccf2-1bab-4bda-a5ba-blah blah"
}
]
},
"metrics": [
"oWaiting"
]
}
Here is my data action json...
{
"name": "Get Calls In Queue",
"integrationType": "purecloud-data-actions",
"actionType": "custom",
"config": {
"request": {
"requestUrlTemplate": "/api/v2/analytics/queues/observations/query",
"requestType": "POST",
"body": {
"filter": {
"type": "and",
"predicates": [
{
"type": "dimension",
"dimension": "queueId",
"operator": "matches",
"value": "${input.QUEUE_ID}"
}
]
},
"metrics": [
"oWaiting"
]
},
"headers": {
"UserAgent": "PureCloudIntegrations/1.0",
"Content-Type": "application/x-www-form-urlencoded"
},
"requestTemplate": "${input.rawRequest}"
},
"response": {
"translationMap": {
"contacts_in_queue": "$.results[0]"
},
"translationMapDefaults": {},
"successTemplate": "{\n \"contacts_in_queue\": ${contacts_in_queue}\n}"
}
},
"contract": {
"input": {
"inputSchema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Contacts in queue Request",
"description": "Contacts in queue media type and queue.",
"type": "object",
"required": [
"QUEUE_ID"
],
"properties": {
"QUEUE_ID": {
"description": "The queue ID.",
"type": "string"
}
},
"additionalProperties": true
}
},
"output": {
"successSchema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Get contacts in queue Response",
"description": "Returns the number of contacts in queue.",
"type": "object",
"properties": {
"contacts_in_queue": {
"description": "The number of contacts in queue for the specified media type and queue.",
"type": "integer"
}
},
"additionalProperties": true
}
}
},
"secure": false
}
The json imports fine and passes tests right down to "Execute'.
I think it's the "body" array. Because the error when testing/validating the data action is...
* REST call for action execute failed. Message:Request to backend service failed. Response from web service: {"message":"HTTP 415 Unsupported Media Type","code":"unsupported media type","status":415,"contextId":"xxx-1106-4a50-8e1e-xxx","details":[],"errors":[]} [xxx-c474-4a5f-a55a-xxx]