The Great Open Source Debate with Elastic, Gluu and GitHub 🎤 Oct 26

Does the groups.info rest api with query param roomName handle names with spaces correctly?

Hello,

I’ve enabled the setting that allows special chars in room names and am successfully able to create room names with spaces in them.

I would now like to hit the groups.info endpoint using the query param roomName.

However, this is the url that’s generated:

https://my-rc-server-endpoint/api/v1/groups.info?roomName=random%20room%20name

and the response that’s received:

{
    "success": false,
    "error": "The required \"roomId\" or \"roomName\" param provided does not match any group [error-room-not-found]",
    "errorType": "error-room-not-found"
}

So I’m guessing that I’m going to have to use the roomId to get the room information or is there still a way to query groups.info using the roomName of a room that has spaces in its name?

As it turns out, I had a look in the mongo collection called rocketchat_rooms and saw that there are two name fields. One is called fname and the other is called name.

fname seems to be the actual name whereas name is normalized so the spaces were swapped with hyphens so when I queried using the name instead of the fname (which is what I was using initially) like the following

https://my-rc-server-endpoint/api/v1/groups.info?roomName=random-room-name

then it worked!

1 Like

Nice!

Thanks for sharing the solution!