# Plex API not returning added metadata

**URL:** <https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669>\
**Category:** Dev/API Corner\
**Tags:** server-docker\
**Created:** [June 1, 2021, 3:42am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669 "2021-06-01T03:42:37Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 1, 2021, 3:42am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/1 "2021-06-01T03:42:37Z")

</div>

When I get media details from a url-based API call, it is not showing any metadata that I have manually added.

In this case, I added a genre tag to a title, via the UI. I can filter by this in the UI fine. But when I get that data from the API call, it only shows the original genre data.  
 ![FB_IMG_1622518834763](https://global.discourse-cdn.com/plex/original/3X/f/9/f9d3ccf6cd3e4c7553ab45be8d436138d6c88863.jpeg)  
 ![FB_IMG_1622518839165](https://global.discourse-cdn.com/plex/original/3X/6/c/6c0e2ad8df762bb55b7979de660b3a3b424ddb09.jpeg)

Is user-customised metadata stored elsewhere?

---

<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:** [June 1, 2021, 4:30am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/2 "2021-06-01T04:30:55Z")

</div>

Are you certain you’re looking at the same item?

I just added a custom Genre tag to a show and it immediately appeared.

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 1, 2021, 4:44am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/3 "2021-06-01T04:44:34Z")

</div>

Yes, definite the same item from the API as what I edited in the UI.

To be clear, changes to genre show in the Plex UI immediately, but they do not show in data returned from the API.

You are returning data via the API, right?

---

<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:** [June 1, 2021, 5:22am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/4 "2021-06-01T05:22:39Z")

</div>

> [@petersem](#):
>
> You are returning data via the API, right?

Yup.

> [http://127.0.0.1:32400/library/metadata/{ratingKey}](http://127.0.0.1:32400/library/metadata/%7BratingKey%7D)

I don’t think it matters, but which agent?

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 1, 2021, 5:45am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/5 "2021-06-01T05:45:07Z")

</div>

I’m using the new plex movie and tv show agents. Weird thing is that I’m seeing the data now, a few hours later. I’ll close this and investigate further. thanks for the response.

---

<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:** [June 1, 2021, 5:47am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/6 "2021-06-01T05:47:13Z")

</div>

That’s … that’s really odd.

When Genre is updated the records in the database are updated instantly.

Glad it’s working. 🤷‍♂️ 🤷‍♀️

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 1, 2021, 6:01am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/7 "2021-06-01T06:01:29Z")

</div>

@Volts Okay, i’ve found the issue. When i use the /library/metadata/{ratingKey} url, then it works. BUT, if i use the serverIP:32400/library/sections/2/all?X-Plex-Token=??? URL to list everything, then the corresponding item does not have the updated genre.

So, via {ratingKey}

![detail](https://global.discourse-cdn.com/plex/original/3X/d/d/ddc5af677ab0fa26b573c2b90d988ef20c21e5f2.png)

then from list contents of library

![list](https://global.discourse-cdn.com/plex/original/3X/b/7/b728ce5cccf12d10772cc12aac8e58e8bdc575c3.png)

And i need the full list for my purposes.

---

<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:** [June 1, 2021, 4:14pm UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/8 "2021-06-01T16:14:52Z")

</div>

That’s a mystery to me too. Both update immediately for me.

Are other data updates visible on `/library/sections/{librarySectionID}/all`? It couldn’t just be something stale/caching somehow, could it?

Does restarting PMS make a difference?

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 1, 2021, 10:21pm UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/9 "2021-06-01T22:21:34Z")

</div>

Will check it out and advise. But it’s very strange to see it in one set of data immediately, but not another. Have tried refreshing metadata and rescanning, but no change. Advise later when I get a chance to restart

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 2, 2021, 2:28am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/10 "2021-06-02T02:28:28Z")

</div>

Node. Plex restart makes no difference. Nor does emptying the cache or even running incognito ☹

---

<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:** [June 2, 2021, 2:29am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/11 "2021-06-02T02:29:54Z")

</div>

I’ve got no guesses.

Do you see the same thing if you create a test library?

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 2, 2021, 2:35am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/12 "2021-06-02T02:35:28Z")

</div>

I’ll give it a while and let you know. Ou of interest, which agents are you running for shows? and also What is your agent order?

i even tried enabling local metadata and rescanned, however this didnt change anything.

---

<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:** [June 2, 2021, 2:48am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/13 "2021-06-02T02:48:31Z")

</div>

I’m using the **Plex TV Series** agent, so the agent order doesn’t apply.

I’d ask what the database shows you, but I’m sure that’s been updated, since you see the results in the GUI and for individual item queries.

---

<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:** [June 2, 2021, 2:52am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/14 "2021-06-02T02:52:52Z")

</div>

Oh wait, I think I have an explanation.

Only the first two genre tags are stored inline in the `metadata_items` table and update immediately. And only the first two are returned when querying `/library/sections/{librarySectionID}/all`

Other tags are stored in the `tags` table, and are returned when querying individual items.

In your example above you’ve added a third tag, so you need to query the specific item directly.

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 2, 2021, 3:38am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/15 "2021-06-02T03:38:53Z")

</div>

yeah… its super strange… even more so that both the individual AND list works for you

I keep wondering if there is some additional job or step than is missing to update everything …

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 2, 2021, 3:39am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/16 "2021-06-02T03:39:48Z")

</div>

oh hang on … so you dont see added genre metadata beyond two items? Damn… that just feels cludgy from a data perspective… unfortunately, it’s not feasible for me to individually query every item in a list. Would just slow it down too much when i am talking a full list of all titles.

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 2, 2021, 3:48am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/17 "2021-06-02T03:48:11Z")

</div>

But i can confirm that you are exactly right on this. If I delete all the genres, then add them with my genre first, then i see the data.  
 ![image](https://global.discourse-cdn.com/plex/original/3X/5/6/56b32603962cc2f1814310e80f671b062b588dc1.png)

Of course this doesn’t solve my problem for my app. (filter by Genre option)  
[Posterr](https://hub.docker.com/r/petersem/posterr)

---

<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:** [June 2, 2021, 4:44am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/18 "2021-06-02T04:44:50Z")

</div>

> [@petersem](#):
>
> that just feels cludgy from a data perspective

I bet it’s a performance optimization. The database design is slightly de-normalized for performance, while keeping the flexibility to use as many genres as desired.

> [@](#):
>
> it’s not feasible for me to individually query every item in a list. Would just slow it down too much when i am talking a full list of all titles.

Are the top two genres enough for your app in the overview?

Pull it from the DB directly! (heh)

Or - more seriously - schedule it async and cache the results.

---

<div class="post-metadata">

**Author:** ![petersem](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/petersem/32/109189_2.png) [@petersem](https://forums.plex.tv/u/petersem)\
**Post date:** [June 2, 2021, 5:03am UTC](https://forums.plex.tv/t/plex-api-not-returning-added-metadata/719669/19 "2021-06-02T05:03:32Z")

</div>

trouble is that genres are seemingly populated in any order, with no preference. plus, some of my users want to add their own genres. (like ‘monster’ for monster movies)

Im not keen on the idea of connecting to a db directly, when there is an existing API. Too easy to cause performance issues, plus DB schema changes would be a nightmare. I already do async calls and cache results, but the data is quite dynamic. This, coupled with response time considerations means that pre-caching everything is not really an option. (have you seen the size of some peoples libraries?) 🙂

anyhow… we have an answer, if not a solution. Thanks for your help in figuring this out. Give Posterr a try if you get a chance. 🙂

Long and the short of it is that “filter by genre” may not stay in my app. ☹
