Legacy Dev Forum Posts

 View Only

Sign Up

Get the total of ON_QUEUE agents

  • 1.  Get the total of ON_QUEUE agents

    Posted 06-05-2025 19:06

    robm | 2020-10-27 09:02:17 UTC | #1

    Hello,

    Our customer would like to know the amount of ON_QUEUE agents on their platform. I tried some options using the search API, but although I get results their never based on the agent status. Also I know that it is possible to retrieve this information by queue, but as we use many queues and agents are located over several queues this will not provide the correct data.

    Is there any way to do a simple search and get the total amount of ON_QUEUE agents?

    Below an example of what I tried:

    {
      "pageSize": "100",
      "pageNumber": 1,
      "types": [
        "users",
        "groups",
        "locations"
      ],
      "sortOrder": "ASC",
      "returnFields": [
        "name",
        "presence",
        "routingStatus"
      ],
      "query": [
        {
          "type": "EXACT",
          "fields": [
            "routingStatus"
          ],
          "value": "IDLE",
          "operator": "AND"
        }
      ]
    }
    
    This comes back with nothing, but if I search on for example my name I get a result.
    
    Best regards,
    Rob
    
    -------------------------
    
    John_Carnell | 2020-10-27 12:57:31 UTC | #2
    
    Hi Rob,
    
    Thanks for posting.  You do not want to use our search APIs as they will not return the data you are looking for. 
     The best way to do this is to use the [Analytics Observations API for Queues](/api/rest/v2/analytics/queue.html#example_query).  This will tell the user count by status for the queue.  Here is an example of where I pulled user routing status from two queues.  Here is the query I issued:

    { "filter": { "type": "or", "clauses": [ { "type": "or", "predicates": [ { "type": "dimension", "dimension": "queueId", "operator": "matches", "value": "526f76bb-0d66-4812-9a9f-c2cc0a886074" } ] } ], "predicates": [ { "type": "dimension", "dimension": "queueId", "operator": "matches", "value": "7a00f147-0a7e-47ee-b972-9559faba30ce" } ] }, "metrics": [ "oOnQueueUsers", "oUserRoutingStatuses" ] }

    
    The call returned these results:

    { "results": [ { "group": { "queueId": "7a00f147-0a7e-47ee-b972-9559faba30ce" }, "data": [ { "metric": "oUserRoutingStatuses", "qualifier": "INTERACTING", "stats": { "count": 1 } }, { "metric": "oUserRoutingStatuses", "qualifier": "IDLE", "stats": { "count": 1 } }, { "metric": "oUserRoutingStatuses", "qualifier": "OFFQUEUE", "stats": { "count": 2 } }, { "metric": "oOnQueueUsers", "qualifier": "INTERACTING", "stats": { "count": 1 } }, { "metric": "oOnQueueUsers", "qualifier": "IDLE", "stats": { "count": 1 } } ] }, { "group": { "queueId": "526f76bb-0d66-4812-9a9f-c2cc0a886074" }, "data": [ { "metric": "oUserRoutingStatuses", "qualifier": "OFFQUEUE", "stats": { "count": 2 } } ] } ] } ```

    I would recommend you play around with the Query Builder tool to help familiarize yourself with how our query language works.

    Unfortunately, we do not currently support returning all of the queues in the call and you have to specify the queue id you want in the query. You can do this by specifying multiple "or" predicates using the queue ids. The analytics team recommends using no more than 50 predicates at a time in your query. To get all of the queues in your org, you can use the Routing Endpoints. Its a bit ugly, but it can be done.

    Thanks, John Carnell Manager, Developer Engagement


    robm | 2020-10-27 15:14:00 UTC | #3

    Hi John,

    Thanks for the feedback, I used the Analytics API also and found out that it can only be asked on a per queue basis. So we are thinking now of creating one extra super queue where all agents are located so that we can get the status. That queue then will not be used for routing but pure for the statistics.

    Thanks. Best regards, Rob


    system | 2020-11-26 15:14:00 UTC | #4

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