Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Admins should be able to list all rooms on the server #6424

Closed
rxl881 opened this issue Nov 27, 2019 · 6 comments
Closed

Admins should be able to list all rooms on the server #6424

rxl881 opened this issue Nov 27, 2019 · 6 comments
Assignees
Labels
A-Admin-API z-feature (Deprecated Label)

Comments

@rxl881
Copy link

rxl881 commented Nov 27, 2019

Description:

It would be incredibly useful for server admins to be able to list all rooms on the server (together with the room names / aliases).

This could be used together with media store APIs etc. to list a breakdown of resource usage per room. It could also be used along with the room shutdown and room purge APIs etc.

It would be good to have this asap., as all of these features are being requested by users.

@rxl881
Copy link
Author

rxl881 commented Nov 27, 2019

@neilisfragile -- This is probably my #1 request for Synapse admin API features right now.

@anoadragon453
Copy link
Member

Since calculating the name for each room isn't trivial, and thus the query may take a long time on a server with many, many rooms, I think it best to make this endpoint support pagination.

Here's a quick design I threw together:

Request:

POST /_synapse/admin/v1/get_rooms

{
  "offset": 0,  # default 0
  "limit": 50   # if not provided, no limit will be applied
}

Response:

{
  "total": 1234  # The total number of rooms
  "rooms": [
    {
      "id": "!abcdefg1234:example.com",  # The ID of the room
      "name": "My Great Room!",          # The name of the room
      "alias": "#greatroom:example.com"  # Optional, main room alias
    },
    { ... }
  ]
}

If offset + limit spills over the end of the room list (e.g. offset 0 + limit 50 for 45 total rooms) only 45 rooms will be returned.

@rxl881
Copy link
Author

rxl881 commented Dec 24, 2019

Thanks @anoadragon453. This looks good and would definitely be better than nothing. However, for this to be really useful, is it possible to do any sort of server-side sorting of the rooms, e.g. by name or creation date? Also, is it possible to search / filter the results? E.g:

{
  "offset": 0,  # default 0
  "limit": 50,   # if not provided, no limit will be applied,
  "sort": {
    "roomName": -1,
  }
  "match: {
    "roomName": "^needle.*"
  }
}

@anoadragon453
Copy link
Member

@rxl881 Heads up that this is how this API has shaped up: https://github.com/matrix-org/synapse/blob/ed5457c28b0a0e17398c403f0ecef26f8678f3e0/docs/admin_api/rooms.md

Let me know what you think.

@rxl881
Copy link
Author

rxl881 commented Jan 20, 2020

@anoadragon453 -- That looks absolutely perfect. Thanks!!!

@anoadragon453
Copy link
Member

This is done in #6720

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Admin-API z-feature (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

3 participants