fix: Immich v3 API compatibility - #55
Merged
Merged
Conversation
Immich v3.0 removed the nested assets array from GET /api/albums/{id} and
deprecated the PUT asset routes in favor of PATCH.
- getAlbumAssetIDs now lists an album's assets via POST /api/search/metadata
with albumIds, instead of the album detail endpoint (which no longer
returns assets on v3). Folded the identical tag/album pagination into one
searchAssetIDs helper; remove the now-unused ImmichAlbumDetailResponse.
- bulkUpdateLocation uses PATCH /api/assets instead of PUT.
- Update album-sync and bulk-update tests to the new endpoints.
Verified live against an Immich v3 server: forced album re-sync succeeds and
repopulates album membership; PATCH /api/assets returns 204.
There was a problem hiding this comment.
Pull request overview
Updates the backend Immich client and related tests to restore compatibility with Immich v3.0 breaking API changes (album asset listing and asset update method), ensuring album sync and geotag writes continue working.
Changes:
- Switch album asset ID retrieval from
GET /api/albums/{id}toPOST /api/search/metadataand consolidate tag/album asset-ID listing intosearchAssetIDs. - Change geotag bulk update from
PUT /api/assetstoPATCH /api/assets. - Update unit tests and remove the now-unused
ImmichAlbumDetailResponsetype.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| backend/types.go | Removes the obsolete album detail response type that depended on the removed assets field. |
| backend/immichClient.go | Uses PATCH /api/assets and introduces shared searchAssetIDs for tag/album asset-ID pagination via /api/search/metadata. |
| backend/syncService_test.go | Updates sync and client tests to mock /api/search/metadata for album asset ID listing and to expect PATCH /api/assets. |
| backend/handlers_test.go | Updates handler tests to expect PATCH /api/assets for location updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…in test - Paginate searchAssetIDs like syncAssets: follow the server-provided nextPage token (not a blind increment) and stop when a page is empty, guarding against non-sequential or empty pages - TestImmichGetAlbumAssetIDs now asserts the request is a POST filtering by albumIds, so a wrong method or filter key would fail the test
- Add TestSearchAssetIDsFollowsNextPage (multi-page: follows the nextPage token to page 2 and terminates) and TestSearchAssetIDsRejectsNonNumericNextPage, covering the token-following loop that had no direct test - Replace the `for i := 0; i < searchMaxPages; i++` bound loop (unused i) with `for range searchMaxPages`
Make mock-handler assertions actionable: check the JSON decode error and the albumIds/page type assertions instead of silently continuing with a nil map, so a malformed request fails with a clear message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes immich-places work against Immich v3.0, which introduced breaking API changes for third-party integrations.
Breaking changes handled
GET /api/albums/{id}no longer returns the nestedassetsarray.getAlbumAssetIDsrelied on it, so on v3 albums synced with zero asset associations (the album filter/GPS counts break on any re-sync). It now lists an album's assets viaPOST /api/search/metadatawithalbumIds— the same paginated path already used for tags. The two were folded into a singlesearchAssetIDs(filterKey, filterID)helper, and the now-unusedImmichAlbumDetailResponsetype was removed.bulkUpdateLocation(the geotag write) now usesPATCH /api/assets.Not affected
Assets, map markers, tags, stacks, libraries, thumbnails, search, and
/users/meare unchanged — immich-places doesn't read any of the removed response fields (deviceId,deviceAssetId,faces, albumowner/ownerId), and Go ignores absent JSON fields.Verification
Confirmed live against an Immich v3 server (non-destructive probes):
GET /api/albums/{id}returns 200 with noassetskey (confirmed removed).POST /api/search/metadata {albumIds}returns 200, paginated.albumAssets.PUTandPATCH /api/assetsreturn 204; switched to PATCH.Backend build + full test suite +
go vetall green. Album-sync and bulk-update tests updated to the new endpoints.