Legacy Dev Forum Posts

 View Only

Sign Up

Why does the response from /users/aggregates/query come with "None" values?

  • 1.  Why does the response from /users/aggregates/query come with "None" values?

    Posted 06-05-2025 18:32

    Serhii | 2024-08-15 07:31:52 UTC | #1

    Hello! I am using python SDK for `POST /api/v2/analytics/users/aggregates/query HTTP/1.1` query

    api_instance = PureCloudPlatformClientV2.UsersApi()
    body = PureCloudPlatformClientV2.UserAggregationQuery() 
    start_date = self.start_day()
    end_date = self.now_time()
    body.interval = f"{start_date}/{end_date}"
    body.group_by = ["userId"]
    body.metrics = [ "tSystemPresence"]
    filter_ = PureCloudPlatformClientV2.UserAggregateQueryFilter()
    filter_.predicates = []           
    for id in sub_agents_statistic:
          user = PureCloudPlatformClientV2.UserAggregateQueryPredicate()
          user.type = 'dimension'
          user.dimension = "userId"
          user.value = id                
          filter_.type = "or"
          filter_.predicates.append(user)
      body.filter = filter_
      api_response = api_instance.post_analytics_users_aggregates_query(body)

    And here is a part of the result:

    "group": {"userId": "4e9d8b2d-24e7-4937-9661-60adba574fff"}}, {"data": [{"interval": "2024-08-12T00:00:00.000Z/2024-08-12T12:29:05.000Z",
    "metrics": [{"metric": "tSystemPresence",
        "qualifier": "OFFLINE",
        "stats": {"count": "None",
         "count_negative": "None",
         "count_positive": "None",
         "current": "None",
         "denominator": "None",
         "max": "None",
         "min": "None",
         "numerator": "None",
         "p95": "None",
         "p99": "None",
         "ratio": "None",
         "sum": 41143457.0,
         "target": "None"}},
    {"metric": "tSystemPresence",
          "qualifier": "AVAILABLE",
          "stats": {"count": "None",
           "count_negative": "None",
           "count_positive": "None",
           "current": "None",
           "denominator": "None",
           "max": "None",
           "min": "None",
           "numerator": "None",
           "p95": "None",
           "p99": "None",
           "ratio": "None",
           "sum": 670367.0,
           "target": "None"}} 
             ...

    I need "max" and "min" values ​​but I always get None values. I tried using Http requests instead of python SDK but the result is the same Why is this happening? Is there another way to get "min", "max" values ​​for user states?

    Thanks everyone in advance


    Eos_Rios | 2024-08-15 12:45:42 UTC | #2

    The user aggregates only support sum.

    You can see examples of this behavior all the way back in 2018.

    The actual API returns blocks like;

                {
                  "metric": "tSystemPresence",
                  "qualifier": "AVAILABLE",
                  "stats": {
                    "sum": 4166402
                  }
                },

    Certain object oriented libraries translate that as Null/Nothing/None entries for the portions it doesn't supply. You're the first person I've seen ask for the other metrics, there isn't even an Ideas entry for it if you want to request one or you could try Customer Care since it's an undocumented difference to the standard behavior of t-Metrics

    Timers (starting with t ) and most observations (starting with o ) returned by aggregate endpoints (e.g. oSurveyTotalScore ) will have count , min , max , and sum .


    Serhii | 2024-08-16 07:08:18 UTC | #3

    Eos_Rios, post:2, topic:27905
    oSurveyTotalScore

    Got it. Thank you very much for your answer


    Dileepkaranki | 2024-08-16 15:41:19 UTC | #4

    I also seen in this behaviour in agent summary performance, wrapup performance and ivr performance. When i was comparing our PBI's with GC performance views we noticed this and updated our documentation.


    system | 2024-09-15 15:33:25 UTC | #5

    This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 27905