chunwei | 2017-02-13 04:29:10 UTC | #1
I am using /api/v2/analytics/conversations/aggregates/query to query for value of workgroup's metrics. However, it does not return the value of serviceLevel and serviceTarget.
Any idea for query the value of serviceLevel and serviceTarget? Did i use the correct api?
Thank you.
anon47305574 | 2017-02-13 15:44:29 UTC | #2
You are using the correct API. Would you mind posting a copy of the query that you are using? This would be helpful for identifying why you may not be seeing the data you expect
chunwei | 2017-02-14 02:21:39 UTC | #3
Below is the query i am using:
Configuration.Default.AccessToken = AccessToken;
var apiInstance = new AnalyticsApi();
StartDate = System.DateTime.Today.Date.ToString("yyyy-MM-ddTHH\\:mm\\:sszzz"); EndDate = System.DateTime.Today.Date.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-ddTHH\\:mm\\:sszzz"); string Interval = StartDate + "/" + EndDate;
string Granularity = "P1D";
List<AggregationQuery.GroupByEnum> GroupBy = new List<AggregationQuery.GroupByEnum>(); AggregationQuery.GroupByEnum MediaType = AggregationQuery.GroupByEnum.Mediatype; GroupBy.Add(MediaType);
List<AnalyticsQueryPredicate> PredicatesList = new List<AnalyticsQueryPredicate>(); AnalyticsQueryPredicate Predicates1 = new AnalyticsQueryPredicate(); Predicates1.Dimension = AnalyticsQueryPredicate.DimensionEnum.Mediatype; Predicates1.Value = "voice"; PredicatesList.Add(Predicates1);
List<AnalyticsQueryClause> ClausesList = new List<AnalyticsQueryClause>(); AnalyticsQueryClause.TypeEnum ClausesType1 = AnalyticsQueryClause.TypeEnum.Or; AnalyticsQueryClause Clauses1 = new AnalyticsQueryClause(ClausesType1, PredicatesList); ClausesList.Add(Clauses1);
AnalyticsQueryPredicate Predicates2 = new AnalyticsQueryPredicate(); Predicates2.Dimension = AnalyticsQueryPredicate.DimensionEnum.Queueid; Predicates2.Value = Queue.QueueID; PredicatesList.Add(Predicates2);
AnalyticsQueryClause.TypeEnum ClausesType2 = AnalyticsQueryClause.TypeEnum.And; AnalyticsQueryClause Clauses2 = new AnalyticsQueryClause(ClausesType2, PredicatesList); ClausesList.Add(Clauses2);
AnalyticsQueryFilter.TypeEnum FilterType = AnalyticsQueryFilter.TypeEnum.And; AnalyticsQueryFilter Filter = new AnalyticsQueryFilter(FilterType, ClausesList, null);
AggregationQuery body = new AggregationQuery(Interval, Granularity, null, GroupBy, Filter, null, true);
Thanks.
chunwei | 2017-02-14 02:54:26 UTC | #4
Hi,
I think this would be better, query body in json format:
{ "interval": "2017-02-14T00:00:00+08:00/2017-02-14T23:59:59+08:00", "granularity": "P1D", "groupBy": [ "mediaType" ], "filter": { "type": "and", "clauses": [ { "type": "and", "predicates": [ { "dimension": "mediaType", "value": "voice" }, { "dimension": "queueId", "value": "bfa20a0d-977a-4a09-a627-253a9072bd12" } ] } ] }, "flattenMultivaluedDimensions": false }
Result as below:
{ "results": [ { "group": { "mediaType": "voice" }, "data": [ { "interval": "2017-02-13T16:00:00.000Z/2017-02-14T16:00:00.000Z", "metrics": [ { "metric": "tAbandon", "stats": { "max": 20320.0, "count": 1, "sum": 20320.0 } }, { "metric": "tAcw", "stats": { "max": 1000.0, "count": 6, "sum": 6000.0 } }, { "metric": "nOffered", "stats": { "count": 8 } }, { "metric": "tHandle", "stats": { "max": 174859.0, "count": 6, "sum": 510541.0 } }, { "metric": "tTalkComplete", "stats": { "max": 173859.0, "count": 6, "sum": 504541.0 } }, { "metric": "tAnswered", "stats": { "max": 9768.0, "count": 7, "sum": 52917.0 } }, { "metric": "tTalk", "stats": { "max": 173859.0, "count": 6, "sum": 504541.0 } }, { "metric": "tAcd", "stats": { "max": 9860.0, "count": 7, "sum": 53129.0 } }, { "metric": "nError", "stats": { "count": 1 } } ] } ] } ] }
Thanks.
anon47305574 | 2017-02-14 04:17:44 UTC | #5
There is a bug on our end where some queries omit service level, however a few minor tweaks to your query should skirt around that issue until we get things resolved on our end. Specifically:
- you shouldn't need to do the interval boundary minus one second. Our intervals are inclusive on the left and exclusive on the right, so it should all work out as you intend.
- all aggregate queries have an implicit group-by mediatype, so that isn't necessary to include (but harmless either way). Note I also added queueId into the groupBy block.
Your above query reformulated below by way of example. I hope this helps
{ "interval": "2017-02-14T00:00:00+08:00\/2017-02-15T00:00:00+08:00", "granularity": "P1D", "groupBy": [ "queueId" ], "filter": { "type": "and", "clauses": [ { "type": "and", "predicates": [ { "dimension": "mediaType", "value": "voice" }, { "dimension": "queueId", "value": "bfa20a0d-977a-4a09-a627-253a9072bd12" } ] } ] } }
chunwei | 2017-02-14 10:35:08 UTC | #6
Thanks Mike.
Would like to know more.
When will the bug being fixed?
Does the return value of serviceLevel is based on what we set for the queue? or the default serviceLevel?
Thanks.
anon47305574 | 2017-02-14 14:53:11 UTC | #7
Bug fix: not prioritized at the moment, so hard to put a date on it.
The service level is specific to what is configured for that queue+media type as it applied in the interval you query for
chunwei | 2017-02-16 04:02:25 UTC | #8
Thanks for for information given.
Since i have filter those data with queueId, can i know what is the used of group by for queueId?
Also, can i know how the Purecloud page to get the serviceLevel? What is the API there use? <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/9ecde3f02f4d9b66c5660bd4f482503e3f2154ed.png" width="690" height="180">
Thanks.
system | 2017-08-28 19:32:04 UTC | #9
This post was migrated from the old Developer Forum.
ref: 913