I'm new here so nice to meet you all, I hope we can help each other.
My problem is: I'm trying to find a way to get live data about which queues are associated to each user, via API.
I tried to first get all users with the User API ( /api/v2/users ) and then, for each user, get the queues associated with them, with the Get queues for user API ( /api/v2/users/{userId}/queues), but there are like 200 users in the platform and for each user, from 4 to 9 queues associated. The result is the script takes 7 minutes to refresh.
Am I doing something wrong on my approach or something else?
I would highly recommend using notifications for this so your application can be kept up to date in real-time. You can subscribe to the topic v2.routing.queues.{id}.users to be notified when a queue's membership changes. If you need user presence for another reason or you need to subscribe per user and not per queue, you can use v2.users.{id}.activity, which contains the user's queue membership. You'll need to initialize your application's state using the API, but using notifications will be much less cumbersome for your app after the initial data load.