I have been working on using the /api/v2/analytics/users/aggregates/query to get 30 minute intervals for user status. I have included the query below. My issue is that when I run this query inside of python I get results as none. When I run this query inside of the Execute Request inside of the Analytics API explorer I get full results for this user.
api_instance = PureCloudPlatformClientV2.UsersApi();
body = PureCloudPlatformClientV2.UserAggregationQuery()
filterObj = PureCloudPlatformClientV2.UserAggregateQueryFilter()
predicate1 = PureCloudPlatformClientV2.UserAggregateQueryPredicate()
predicatedArray = []
predicate1.dimension = "userId"
predicate1.value = "6e63a163-d4d0-47ef-8f88-9ec81fedfb7e"
predicate1.operator = "matches"
predicate1.type = "dimension"
predicatedArray.append(predicate1)
filterObj.type = "or"
filterObj.predicates = predicatedArray
body.interval = '2024-03-18T00:00:00/2024-03-19T00:00:00'
body.group_by = ["userId"]
body.granularity = "PT30M"
body.metrics = ["tSystemPresence"]
body.filter = filterObj
print(body)
try:
api_response = api_instance.post_analytics_users_aggregates_query(body)
print(api_response)
except ApiException as e:
print("Exception when calling UsersApi->post_analytics_users_aggregates_query: %s\n" % e)
The body looks like this in the request:
{'alternate_time_dimension': None,
'filter': {'clauses': None,
'predicates': [{'dimension': 'userId',
'operator': 'matches',
'range': None,
'type': 'dimension',
'value': '6e63a163-d4d0-47ef-8f88-9ec81fedfb7e'}],
'type': 'or'},
'flatten_multivalued_dimensions': None,
'granularity': 'PT30M',
'group_by': ['userId'],
'interval': '2024-03-18T00:00:00/2024-03-19T00:00:00',
'metrics': ['tSystemPresence'],
'time_zone': None,
'views': None}
Any advice or guidance on this is appreciated, thank you!