anon25707902 | 2016-08-12 16:07:51 UTC | #1
Hi,
I would like to bulid an aggregation query to get the number of calls aggregated per wrap-up codes per agent for a given campaign. I tried the following (thank's for Developper-tool !) but I never get results :
{
"interval": "2016-08-11T09:09:35.000Z/2016-08-14T13:09:38.000Z",
"groupBy": [
"userId",
"wrapUpCode"
],
"filter": {
"type": "and",
"predicates": [
{
"type": "dimension",
"dimension": "outboundCampaignId",
"operator": "matches",
"value": "xyz"
}
]
},
"metrics": [
"tAcw"
]
}
("xyz" is the campaign Id)
What am I missing?
tim.smith | 2016-08-12 16:13:17 UTC | #2
If you're not getting data back but the response is successful (200 OK), it means that there is no data that meets your query's criteria. I would suggest making the query less strict until you get some data, then refine it based on the data that you do have.
anon25707902 | 2016-08-22 08:05:49 UTC | #3
Thanks but I get a response with no wrapUpCode detail :
{
"results": [
{
"group": {
"mediaType": "voice",
"userId": "abc",
"outboundCampaignId": "xyz"
},
"data": [
{
"interval": "2016-08-06T12:57:13.289Z/2016-08-13T12:57:16.462Z",
"metrics": [
{
"metric": "tHandle",
"stats": {
"max": 41292,
"count": 4,
"sum": 56956
}
}
]
}
]
}
]
}
It seems to be aggregated with proper data but I don't get any wrapUpCode information. Is there something I'm missing?
tim.smith | 2016-08-15 14:42:17 UTC | #4
Here's a barebones query you can use to get a count of wrapup codes:
{ "interval": "2016-07-16T13:51:27.000Z/2016-08-15T13:51:32.528Z", "groupBy": [ "wrapUpCode" ], "metrics": [ "tAcw" ] }
At the bottom of the Metrics page, there is a short section about Statistics. Some metrics have the count statistic, some don't. For this case, tAcw is an appropriate metric when grouping by wrapUpCode. I'm working with the Analytics team to make this documentation more robust so this type of information will be documented.
The above query returns results that are grouped by wrapUpCode with the auto-added grouping of mediaType. A single result group looks like the object below, and the count you're looking for will be located at response.results[x].data[x].metrics[x].stats.count.
{ "group": { "mediaType": "voice", "wrapUpCode": "7fb334b0-0e9e-11e4-9191-0800200c9a66" }, "data": [ { "interval": "2016-07-16T13:51:27.000Z/2016-08-15T13:51:32.528Z", "metrics": [ { "metric": "tAcw", "stats": { "max": 27964000, "count": 5, "sum": 28452000 } } ] } ] }
anon25707902 | 2016-08-22 08:19:17 UTC | #5
Thanks @tim.smith
What is strange is I now get aggregated results the way I would like with the exact same request I used in the first place. It's like statistics couldn't be accessed immediately.
Your request works and could be an immediate workaround.
system | 2017-08-28 19:26:24 UTC | #6
This post was migrated from the old Developer Forum.
ref: 288