Rocket.Chat's Community Open Call 🎤 Jan 19th, 2022 Join us!

Rooms.list fails to respond to list of agents

Description

The following documentation specifies that the /api/v1/livechat/rooms endpoint should accept a list of agents. However, while we can query a single agent ID/username, our team has not been able to successfully pass a list of agents.

(developer-docs/livechat-rooms-list.md at master · RocketChat/developer-docs · GitHub)

Server Setup Information

  • Version of Rocket.Chat Server: latest
  • Operating System: ubuntu:16.04
  • Deployment Method: docker/k8s
  • Number of Running Instances: 10
  • DB Replicaset Oplog: –
  • NodeJS Version: 12.22.1-buster-slim
  • MongoDB Version: 7.11.1
  • Proxy: nginx
  • Firewalls involved: –

Any additional Information

We have tried the following syntaxes (please note that the formatting of this forum is changing [ and ] to a in the display of this post):

/api/v1/livechat/rooms?open=true&agents=spam-agent,jamesbecker&sort={%22lm%22:1}&count=140
/api/v1/livechat/rooms?open=true&agents=“spam-agent”,“jamesbecker”&sort={%22lm%22:1}&count=140
/api/v1/livechat/rooms?open=true&agents=“spam-agent,jamesbecker”&sort={%22lm%22:1}&count=140
/api/v1/livechat/rooms?open=true&agents=[%22spam-agent%22,%22jamesbecker%22]&sort={%22lm%22:1}&count=140
/api/v1/livechat/rooms?open=true&agents=%5B%22spam-agent%22,%22jamesbecker%22%5D&sort={%22lm%22:1}&count=140

Hi! Welcome to our forums :slight_smile:

Can you try something like this:

http://localhost:3000/api/v1/livechat/rooms?open=true&agents[]=agent1&agents[]=admin

Thanks!

1 Like

Thank you dudanogueira, we came to the same conclusion yesterday, except we used agent[0]=user1&agent[1]=user2 syntax.

Thanks again!

Great!

Just added this information for future references in our docs :slight_smile:

Thank you! That is indeed helpful!

For anyone else who runs into this issue it’s worth mentioning that key[0]=string1&key[1]=string2 syntax appears to fail after 21 parameters in our case, but key[]=string1&key[]=string2 syntax is successful. Not sure what is causing it.