Repository navigation
Add GET /admin/realms/{realm}/clients/count endpoint #47291
anis-campos
started this conversation in
Ideas
Replies: 1 comment 2 replies
|
@stianst Sorry for the ping, but I fear the subject is not progressing, is there something missing ? |
8000
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
The Admin REST API currently has no way to count clients in a realm without fetching all of them.
The only available endpoint is
GET /admin/realms/{realm}/clients, which returns a paginated list.To get a total count you must page through all results, which is prohibitively expensive at large scales.
Use Case
We operate a realm with 100K+ service accounts (one client per service, machine identity pattern).
We need to monitor the total count as an operational metric, for example to alert when it crosses a threshold, or to display in a dashboard.
Today this requires iterating through every page of results, which puts unnecessary load on Keycloak and the database.
Proposed Solution
Add a count endpoint mirroring the existing
users/count:Expected behavior:
GET /admin/realms/{realm}/users/countGET /admin/realms/{realm}/clients, at minimumclientId,search, andviewableOnly, so callers can count a filtered subset (e.g. only service accounts viaserviceAccount=true)COUNTquery, not by loading all client records into memoryPrior Art
GET /admin/realms/{realm}/users/countalready does exactly this for users and supports query filters.The same pattern is well-established in the codebase and this would be a natural extension of it.
All reactions