# Get collection metadata by URL as XML?

**URL:** https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540
**Category:** Remote Access
**Tags:** plex-web
**Created:** [February 15, 2022, 3:51pm UTC](https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540 "2022-02-15T15:51:04Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![manfred](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@manfred](https://forums.plex.tv/u/manfred)
#### Post date: [February 15, 2022, 3:51pm UTC](https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540/1 "2022-02-15T15:51:04Z")

</div>

Hi, I’m using [Plex Exporter](https://github.com/Dachande663/Plex-Export) in an enhanced version (by myself) to offer my Plex Server metadata to my kids (living apart from myself). By retrieving XML files from the Plex Server, the data is prepared and displayed and also written to a CSV file.

This works quite well for movies, shows, seasons and episodes.  
For example the link for a movie XML is `http://localhost:32400/library/metadata/86165` (the required token is not displayed here).

I’m wondering if there is a XML-URL for **Collections** as well? Thanks for any hints.

---

<div class="post-metadata">

### Author: ![Volts](https://avatars.discourse-cdn.com/v4/letter/v/a5b964/32.png) [@Volts](https://forums.plex.tv/u/Volts)
#### Post date: [February 15, 2022, 10:02pm UTC](https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540/3 "2022-02-15T22:02:55Z")

</div>

A great resource here is the Python PlexAPI library.

[Collection plexapi.collection — Python PlexAPI documentation](https://python-plexapi.readthedocs.io/en/latest/modules/collection.html)

You can view the source for all methods, including the Plex API URLs that are called.

---

<div class="post-metadata">

### Author: ![manfred](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@manfred](https://forums.plex.tv/u/manfred)
#### Post date: [February 16, 2022, 7:34am UTC](https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540/4 "2022-02-16T07:34:59Z")

</div>

Thanks for the link. It seem that there is no dedicated Plex API link to get the Collections information. But that’s no problem. The Plex Exporter anyway loops over all movies. And the movie-XML contains the Collection informations for this one movie. So I just have to build required structures by myself.

---

<div class="post-metadata">

### Author: ![SwiftPanda16](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/swiftpanda16/32/81839_2.png) [@SwiftPanda16](https://forums.plex.tv/u/SwiftPanda16)
#### Post date: [February 16, 2022, 8:04am UTC](https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540/5 "2022-02-16T08:04:57Z")

</div>

It’s the same URL, just with the collection’s `ratingKey`.

---

<div class="post-metadata">

### Author: ![manfred](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@manfred](https://forums.plex.tv/u/manfred)
#### Post date: [February 16, 2022, 8:36am UTC](https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540/6 "2022-02-16T08:36:02Z")

</div>

From where do I get the collection’s `ratingKey`?  
A movie’s (which is contained in a collection) XML only includes this line:

`<Collection id="22316" filter="collection=22316" tag="<collection name>" />`

This id gives me a `404 Not Found` if I use the URL from my first post and replace 86165 with 22316.

---

<div class="post-metadata">

### Author: ![manfred](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@manfred](https://forums.plex.tv/u/manfred)
#### Post date: [February 16, 2022, 9:17am UTC](https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540/7 "2022-02-16T09:17:45Z")

</div>

Found a solution 😀

`http://<host>:32400/library/sections/1/collection/?X-Plex-Token=<token>`

gives me a nice list of all collections in section `1`.

`http://<host>:32400/library/sections/1/collection/<id>?X-Plex-Token=<token>`

gives me all details of collection `<id>` (which is the same as from my previous post)

Now the question for potential future problems I might have:  
_Where would I have found a documentation of this URL’s?_

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)
#### Post date: [May 17, 2022, 9:18am UTC](https://forums.plex.tv/t/get-collection-metadata-by-url-as-xml/776540/8 "2022-05-17T09:18:33Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
