Legacy Dev Forum Posts

 View Only

Sign Up

Getting all user aggregates from /api/v2/analytics/users/aggregates/query

  • 1.  Getting all user aggregates from /api/v2/analytics/users/aggregates/query

    Posted 06-05-2025 18:29

    azhang | 2024-02-13 20:54:31 UTC | #1

    I'm working on getting status aggregates for all users using the endpoint:

    /api/v2/analytics/users/aggregates/query.

    Since this query requires a UserAggregateQueryFilter, I'm having trouble figuring out how I can get the aggregates for all users in one query rather than having to loop through each userId.

    I tried using this query:

    { "interval": "2024-01-05T00:00:00/2024-01-05T23:59:59", "granularity": "P1D", "timeZone": "UTC", "filter": { "type": "or", "predicates": [ { "dimension": "userId", "operator": "notExists", "value": null } ] }, "groupBy": [ "userId" ], "metrics": [ "tSystemPresence", "tOrganizationPresence", "tAgentRoutingStatus" ] }

    Here is the response: The request failed with response code: 500. Message: Server resources are unable to complete the request.


    tim.smith | 2024-02-13 21:27:58 UTC | #2

    @azhang Please open a case with Genesys Cloud Care to report this issue. The 500 response is a server-side issue and appears to be a bug; all bug reports must go through Care for proper handling. The bug is that the error message is being suppressed instead of propagated on to you, which results in a generic 500 message with no details. This request should result in a 400 with an error message back to you.

    In this case the issue is that you can't use this operator with the dimension userId; you can only use matches to match a specific value (a user's ID). If you want to get data for multiple users, simply add a predicate for each user ID. If you want to do this for "all users", your app would first get a list of users using the API and then run this query in batches, appending the results of each query to get one data set.

    multi-user example:

    {
      "interval": "2024-01-05T00:00:00/2024-01-05T23:59:59",
      "granularity": "P1D",
      "timeZone": "UTC",
      "groupBy": [
        "userId"
      ],
      "metrics": [
        "tSystemPresence",
        "tOrganizationPresence",
        "tAgentRoutingStatus"
      ],
      "filter": {
        "type": "or",
        "predicates": [
          {
            "dimension": "userId",
            "operator": "matches",
            "value": "fdc434b7-12cb-4aa4-b909-95de654e1a06"
          },
          {
            "dimension": "userId",
            "operator": "matches",
            "value": "2800eecd-7e75-4d5e-bdd7-bbc158c5acbb"
          }
        ]
      }
    }

    system | 2024-03-14 21:28:03 UTC | #3

    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: 24628