Skip to content

fix: Immich v3 API compatibility - #55

Merged
Majorfi merged 4 commits into
mainfrom
fix/immich-v3-compat
Jul 3, 2026
Merged

fix: Immich v3 API compatibility#55
Majorfi merged 4 commits into
mainfrom
fix/immich-v3-compat

Conversation

@Majorfi

@Majorfi Majorfi commented Jul 3, 2026

Copy link
Copy Markdown
Owner

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 nested assets array. getAlbumAssetIDs relied 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 via POST /api/search/metadata with albumIds — the same paginated path already used for tags. The two were folded into a single searchAssetIDs(filterKey, filterID) helper, and the now-unused ImmichAlbumDetailResponse type was removed.
  • PUT asset routes deprecated in favor of PATCH. bulkUpdateLocation (the geotag write) now uses PATCH /api/assets.

Not affected

Assets, map markers, tags, stacks, libraries, thumbnails, search, and /users/me are unchanged — immich-places doesn't read any of the removed response fields (deviceId, deviceAssetId, faces, album owner/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 no assets key (confirmed removed).
  • POST /api/search/metadata {albumIds} returns 200, paginated.
  • A forced full album re-sync succeeds for all users and repopulates albumAssets.
  • Both PUT and PATCH /api/assets return 204; switched to PATCH.

Backend build + full test suite + go vet all green. Album-sync and bulk-update tests updated to the new endpoints.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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} to POST /api/search/metadata and consolidate tag/album asset-ID listing into searchAssetIDs.
  • Change geotag bulk update from PUT /api/assets to PATCH /api/assets.
  • Update unit tests and remove the now-unused ImmichAlbumDetailResponse type.

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.

Comment thread backend/immichClient.go
Comment thread backend/syncService_test.go Outdated
…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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread backend/syncService_test.go Outdated
Comment thread backend/syncService_test.go Outdated
Majorfi added 2 commits July 3, 2026 11:28
- 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.
@Majorfi
Majorfi merged commit 27a45c1 into main Jul 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants