SurajAlokSinha | 2017-05-02 13:33:18 UTC | #1
Hi, I want to perform a postConversationsDetailsQuery, but I have not been able to find out how to create a filter for ConversationQuery. I need to define a predicate for the filter is there any example one can look at?
https://developer.mypurecloud.com/api/rest/client-libraries/java/latest/AnalyticsApi.html#postConversationsDetailsQuery
Thanks for all you help
tim.smith | 2017-05-02 14:01:11 UTC | #2
Give this a try. Make sure you're using the latest SDK version. That link is to the old pre-release SDK. New docs: https://developer.mypurecloud.com/api/rest/client-libraries/java/AnalyticsApi.html#postAnalyticsConversationsDetailsQuery
// Create API instance
AnalyticsApi analyticsApi = new AnalyticsApi();
// Create query object and set interval
ConversationQuery query = new ConversationQuery();
query.setInterval("2017-05-01T06:00:00.000Z/2017-05-03T06:00:00.000Z");
// Create predicate to filter by queue
AnalyticsQueryPredicate predicate = new AnalyticsQueryPredicate();
predicate.setType(AnalyticsQueryPredicate.TypeEnum.DIMENSION);
predicate.setDimension(AnalyticsQueryPredicate.DimensionEnum.QUEUEID);
predicate.setOperator(AnalyticsQueryPredicate.OperatorEnum.MATCHES);
predicate.setValue("636f60d4-04d9-4715-9350-7125b9b553db");
// Create a segment filter with the predicate
AnalyticsQueryFilter segmentFilter = new AnalyticsQueryFilter();
segmentFilter.setType(AnalyticsQueryFilter.TypeEnum.OR);
segmentFilter.setPredicates(Collections.singletonList(predicate));
query.setSegmentFilters(Collections.singletonList(segmentFilter));
// Create the request with the query body
PostAnalyticsConversationsDetailsQueryRequest request = PostAnalyticsConversationsDetailsQueryRequest.builder().withBody(query).build();
// Execute the request
AnalyticsConversationQueryResponse response = analyticsApi.postAnalyticsConversationsDetailsQuery(request);
System.out.println(response);
system | 2017-06-02 14:00:54 UTC | #3
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: 1249