#v3 API public album assets list

22 messages · Page 1 of 1 (latest)

hot spindle
#

Hello. I'm the author of syno-photo-frame - a slideshow app for Raspberry Pi, which also supports fetching photos from Immich server from an album shared via a share link. I found it troublesome to support Immich v3 considering the getAlbumInfo API no longer returns list of assets in the album.

Previously with v2 I used the getMySharedLink to get album id using the shared link, and then getAlbumInfo to get ids and EXIF of all the assets in the album. I can see that getMySharedLink response contains an assets field but it always comes back empty (is there some extra parameter I should set?)

The recommendation from migration guide to use POST /api/search/metadata doesn't seem to apply to public or password protected share links:

  • When the share link is password protected, I need to use sharedLinkLogin with the (obligatory) password in request body. The response sets a cookie, but even with that cookie it doesn't allow access to searchAssets ("forbidden" response).
  • When the share link is public (no password), sharedLinkLogin doesn't work because, well, it requires a password in request body - instead I'm using getMySharedLink, but that doesn't set any cookies, so access to searchAssets is also forbidden.

[continued below]

smoky echoBOT
#

:wave: Hey @hot spindle,

Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich immich.

References

#

Checklist

I have...

  1. :ballot_box_with_check: verified I'm on the latest release(note that mobile app releases may take some time).
  2. :ballot_box_with_check: read applicable release notes.
  3. :ballot_box_with_check: reviewed the FAQs for known issues.
  4. :ballot_box_with_check: reviewed Github for known issues.
  5. :ballot_box_with_check: tried accessing Immich via local ip (without a custom reverse proxy).
  6. :ballot_box_with_check: uploaded the relevant information (see below).
  7. :ballot_box_with_check: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable

(an item can be marked as "complete" by reacting with the appropriate number)

Information

In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:

  • Your docker-compose.yml and .env files.
  • Logs from all the containers and their status (see above).
  • All the troubleshooting steps you've tried so far.
  • Any recent changes you've made to Immich or your system.
  • Details about your system (both software/OS and hardware).
  • Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h).
  • The version of the Immich server, mobile app, and other relevant pieces.
  • Any other information that you think might be relevant.

Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

hot spindle
#

The only way to work around this for now was for me to replicate browser client behavior where I'm able to fetch a list of buckets with getTimeBuckets, and then for each bucket getTimeBucket, which contains an array of one or more asset ids, and then for each of those I can do getAssetInfo which finally gives me EXIF and thumbhash of the assets needed to viewAsset.

As you can imagine fetching all the asset metadata this way upfront for a large album is pretty inefficient, as it may potentially need to sent hundreds or thousands of requests to the server, when in v2 it could've all been done in one go.

Is there an alternative way to do this in v3, or do I need to continue this way and potentially modify my app to fetch buckets right before I need the actual photo EXIF and thumbnail? This would pose some challenges since I'm e.g. sorting the assets client side (this is to keep compatibility with Synology Photos which is the other backend my app supports). I also don't want to require user to go through full authentication flow as that would require storing password or API key on the Raspberry Pi - I prefer to at most require a dedicated share link password.

Thanks in advance for any help!

smoky echoBOT
steel tide
#

I'm having the same issue. Upgraded to v3 knowing there would be breaking changes but POST /api/search/metadata doesn't appear to be accessible by public slugs. Previous I did the same path, get shared link to get album info which included the assets. Because of this change my portfolio website is now bricked unless I add an API key or revert back to v2.

boreal violet
#

This is a good call. We missed that. Could you open an issue about it on Github please?

hot spindle
smoky echoBOT
stone epoch
#

@halcyon aspen

halcyon aspen
#

oops lol

boreal violet
hot spindle
#

Hi guys, thanks for the new release 3.0.2. I just updated and attempted to fetch the album assets via a shared link, but I think I misunderstand how it's supposed to work. Let's start with a shared link without a password. In order to get the albumId I used getMySharedLink with album key query parameter in V2, and this seems to work still now in V3.0.2 (the assets field is an empty list but I get the fix was not going to change that). But the response doesn't set any cookies, and so searchAssets with key as query parameter, and {"albumIds": ["..."]} in the body replies with {"message": "Authentication required"}. Am I using it wrong? :S

boreal violet
#

curl -X POST "https://demo.immich.app/api/search/metadata?key=jMcVaRmCLn9oZU_qjqNEgKJObMx4UOMlmeKy_d2qo6dlzakBTx8d89Y-Bf1beCcwZ-M" -H "content-type: application/json" -d '{"albumIds":["49026c04-24be-499c-ada3-e974bcba0741"]}'
This works for me

hot spindle
#

Thanks. Can it matter that the share link was generated in v3.0.1. Let me try that 🙂

boreal violet
#

It shouldn't

#

If you shared the actual code you're using I might be able to point out where it's going wrong

hot spindle
#

curl indeed works so it must be something I'm messing up. Let me dig a bit more and if I can't get it to work I'll put it on github.

#

Yes, definitely something in my code because I also get authentication required on that demo album (though it works with curl so...)

#

Ok, I mixed up query parameters with request body 🤦‍♂️, ok sorry for bothering. 🙂 Thanks again!

boreal violet
#

No worries! Glad it's working now :)

#

And thanks again for reporting this