chore(rest): migrate /api/v1/users.getPresence to OpenAPI endpoint definition
Closed
YA
6mo ago+58+58+01234567890123456789-42-42-01234567890123456789
Migrates the users.getPresence REST API endpoint from the legacy API.v1.addRoute pattern to the new chained API.v1.get() pattern with AJV response schema validation and OpenAPI documentation support.
Endpoints migrated
| Endpoint | Method | Old Pattern | New Pattern |
|---|---|---|---|
users.getPresence | GET | addRoute | .get() chained |
Architectural changes
- Replaced legacy
API.v1.addRoute('users.getPresence', ...)with the new chained.get('users.getPresence', ...)method - Added
400,401error response schemas usingvalidateBadRequestErrorResponseandvalidateUnauthorizedErrorResponse - Added AJV response schema for 200 response with
presence,connectionStatus, andlastLoginfields - Added
query: undefinedexplicitly as per new pattern guidelines connectionStatusandlastLoginare optional — only returned for own user requestslastLoginserialized as ISO string for JSON compatibility
Files changed
apps/meteor/app/api/server/v1/users.ts— Main migration.changeset/migrate-users-getPresence-openapi.md— Changeset entrypackages\rest-typings\src\v1\users.ts— Remove old manual typing
Related project
This continues the REST API migration effort described in the GSoC 2026 project: Replace old REST API definitions over the new API.
cc @diego-sampaio @ggazzo
This PR is part of the ongoing REST API migration effort tracked in RocketChat/Rocket.Chat-Open-API#150
Summary by CodeRabbit
-
API Updates
- users.getPresence now returns presence for other users, and for your own user also includes connectionStatus and optional lastLogin (ISO string).
- The endpoint is now served via the consolidated API surface with stricter response validation for more consistent responses.
-
Documentation
- OpenAPI documentation updated to reflect the new response shape and validation.