jhyler 3 Posted May 30, 2025 Posted May 30, 2025 Still pretty much a newbie with the Emby API, I need some help on how to access collection info. ("Collection" being somewhat an overloaded term, what I mean here is the information you get from the web through My Media -> Collections, and I am looking to access the set of collections at a global level, i.e., not those visible to any particular user). Basically what I want to be able to do is get the list of all the collections in the system and then for each collection, a list of all the items contained in that collection. There is nothing useful for this purpose in the Collections service, so I suspect what I want is accomplished through the ItemsLookupService and/or the Items service. But I'm not seeing it. Can you help? Thanks!
Solution Amything 122 Posted May 30, 2025 Solution Posted May 30, 2025 To get all collections _libraryManager.GetItemIds(new InternalItemsQuery { IncludeItemTypes = new[] { "collection", "Boxset" } }); Items in collection InternalItemsQuery query = new InternalItemsQuery { CollectionIds = new[] { collectionId }, }; long[] items = _libraryManager.GetInternalItemIds(query);
Luke 42077 Posted May 31, 2025 Posted May 31, 2025 6 hours ago, jhyler said: Still pretty much a newbie with the Emby API, I need some help on how to access collection info. ("Collection" being somewhat an overloaded term, what I mean here is the information you get from the web through My Media -> Collections, and I am looking to access the set of collections at a global level, i.e., not those visible to any particular user). Basically what I want to be able to do is get the list of all the collections in the system and then for each collection, a list of all the items contained in that collection. There is nothing useful for this purpose in the Collections service, so I suspect what I want is accomplished through the ItemsLookupService and/or the Items service. But I'm not seeing it. Can you help? Thanks! Hi, what have you done so far with the api?
jhyler 3 Posted May 31, 2025 Author Posted May 31, 2025 (edited) Not a whole lot, Luke, if you look back in my history you'll find two or three threads having to do with extracting info regarding missing episodes - this after the info stopped appearing in the database. Mostly I'm maintaining, and occasionally extending, a reporting system for my library that gives me details of what I hold, what quality I've got it in, what I am missing, where I might find missing or better quality material, etc. The system is most;y based off of SQL queries but as I revisit areas I may switch over to the API when it doesn't cause too much disruption. Today's thread was due to my revisiting a part of the system that ensures the consistency of some collections (I have a folder where everything in it should be part of a particular collection and nothing else should be - turns out it's easier for me to provide the collection than it is to continually remind people that there is a folder view). I puzzled over Amything's C++ for a while, but it led me to the RESTful API entry points I was hoping for. So thanks, Amything! I had gotten myself tripped up since the API was referring to collections as "box sets". My library makes heavy use of box sets (in the '[boxset]' naming convention sense) even though Emby doesn't do much with them anymore) as well as collections, and that led me astray. And thank you too, Luke. Edited May 31, 2025 by jhyler
Amything 122 Posted May 31, 2025 Posted May 31, 2025 Ah sorry, reading fail, for some reason I thought you were talking about the SDK.
Luke 42077 Posted June 1, 2025 Posted June 1, 2025 OK so the api you probably want to look at is: /Users/{UserId}/Items?Recursive=true&IncludeItemTypes=BoxSet
jhyler 3 Posted June 1, 2025 Author Posted June 1, 2025 (edited) What I actually hit on, once I picked up on the hint in Amything's snippet, was /emby/Items?IncludeItemTypes=BoxSet&Recursive=true Seemed to me to be a closer fit - not all users necessarily see all collections and I wanted all. So far it's working well. Cheers! Edited June 1, 2025 by jhyler 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now