Is there a way to make a call to the API and get all users and the queues assigned to those users? My current approach is get all users then loop through the users and get the queues assigned but this is not efficient, and in some cases is causing max call exceded errors (300+ users). I'm also trying to get all queues and then loop through and get the users assigned to the queue but this in cases where there are 100+ queues isn't efficient either.
I'm showing all users in a html table and using notifications for certain alerts that I have configured so I really need to have this data all at once so API Paging is not an option for me.
Especially because you're using notifications already, I'd highly recommend using v2.routing.queues.{id}.users to keep track of queue membership changes in real time instead of polling for changes. Using notifications over polling is always recommended, and will likely provide a better experience for users of your app.
To initialize the state of your app, your best bet is to get user membership by queue using GET /api/v2/routing/queues/{queueId}/users, as opposed to getting queue membership by user using GET /api/v2/users/{userId}/queues. The former should take less requests. There is no option to "get everything"; you must page through the results.
Yes, I'm using the notifications to get the queue membership changes. It's just for the initial state that I need to pull all the information, and that initial pull is what I'm trying to optimize.
I will try working with getting the user membership by queue option.
I had the same use case today with having an app showing a list of our active users.
In my case, using notification endpoint is a bit of an overkill as its a LOB app that is just used to load the set of users for admin purposes, and is used maybe a couple of times per week. I have like ~700 active users and ~65 queues.
For my use case, it would have been easier is the queue membership could be pulled in as an expand property of GET /api/v2/users/users or any other way that doesn't require tracking real time data but let's me know which queues are assigned to which agents. (I did want to know if the user has joined the queue and also the ring number, so just attaching a queue id without the joined/joined/ringNumber props to the user object would not suffice.)
Anyway, the approach I went with regarding this was:
Grab users GET /api/v2/users/users
List all queues and check memberCount prop GET /api/v2/routing/queues
Call each queue with membersCount > 0 GET /api/v2/routing/queues/{queueId}/users