Skip to content

Deprecate and remove /api/plex legacy endpoints #2428

@enoch85

Description

@enoch85

Summary

The /api/plex endpoints were replaced by the media-server abstraction layer (/api/media-server) in #2266 (commit 78e8ddca). A backward-compatible legacy controller (plex-api-legacy.controller.ts) was intentionally kept to give external integrations time to migrate. All 19 legacy endpoints already return deprecation headers (X-Deprecated, Deprecation, Link) pointing consumers to the new endpoints.

Current state

  • The UI has zero references to /api/plex — it fully uses /api/media-server
  • The legacy controller is self-contained in a single file (340 lines) and delegates entirely to MediaServerFactory
  • PlexApiService (the raw Plex HTTP client) is not part of this deprecation — it is still used internally by PlexAdapterService

Steps to remove

  1. Delete apps/server/src/modules/api/plex-api/plex-api-legacy.controller.ts
  2. Edit apps/server/src/modules/api/plex-api/plex-api.module.ts:
    • Remove PlexApiLegacyController from the controllers array (leave it as controllers: [] or omit entirely)
    • Remove the forwardRef(() => MediaServerModule) import — it is only needed by the legacy controller
    • Update/remove the @deprecated JSDoc comment on the module
  3. Do NOT delete the following files — they are also used by PlexApiService:
    • apps/server/src/modules/api/plex-api/dto/collection-hub-settings.dto.ts
    • apps/server/src/modules/api/plex-api/interfaces/collection.interface.ts

Bonus: Removing the MediaServerModule import also eliminates a circular dependency between PlexApiModule and MediaServerModule (both currently use forwardRef to reference each other).

Endpoint mapping reference

Legacy (/api/plex/...) New (/api/media-server/...)
GET / GET /
GET /libraries GET /libraries
GET /library/:id/content/:page?amount=N GET /library/:id/content?page=N&limit=N
GET /library/:id/content/search/:query GET /library/:id/content/search/:query
GET /meta/:id GET /meta/:id
GET /meta/:id/seen GET /meta/:id/seen
GET /meta/:id/children GET /meta/:id/children
GET /users GET /users
GET /library/:id/recent GET /library/:id/recent
GET /library/:id/collections GET /library/:id/collections
GET /library/collection/:collectionId GET /collection/:id
GET /library/collection/:collectionId/children GET /collection/:id/children
GET /search/:input GET /search/:query
PUT /library/collection/:collectionId/child/:childId PUT /collection/:collectionId/item/:itemId
DELETE /library/collection/:collectionId/child/:childId DELETE /collection/:collectionId/item/:itemId
PUT /library/collection/update PUT /collection
POST /library/collection/create POST /collection
DELETE /library/collection/:collectionId DELETE /collection/:id
PUT /library/collection/settings PUT /collection/visibility

Acceptance criteria

  • All /api/plex/* routes return 404
  • PlexApiService still works for internal Plex adapter usage
  • No regressions in existing /api/media-server endpoints
  • Circular forwardRef between PlexApiModule and MediaServerModule is eliminated
  • Changelog documents the breaking change with migration guidance

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions