[BUG] Webhooks returning multiple `guid` fields of different datatypes

This is an urgent, breaking bug report but there doesn’t seem to be a proper way to report bugs? Here’s a forum post I guess.

Some time recently, some subset of webhook responses have included two entries for metadata.guid, one with a lower case g and one with an upper case G. For example this is what I get for the film Æon Flux:

$ cat hookdata | jq .Metadata.guid
"plex://movie/5d7768317e9a3c0020c6bf90"
$ cat hookdata | jq .Metadata.Guid
[
  {
    "id": "imdb://tt0402022"
  },
  {
    "id": "tmdb://8202"
  }
]

Case sensitivity is a terrible thing to depend on when your JSON API is consumed by a wide variety of clients in a large number of languages. You’re effectively returning two different guid fields, of different data types, with completely different data in them!

I’ve noticed that this only happens with recently added movies, so I suspect it’s a problem with the new movie agent.

I strongly recommend you pick one and go with it. Those of us working in strongly typed languages would appreciate if you picked an option that would allow a given field to have a consistent type no matter what media you’re playing (i.e. please don’t do array of objects for movies and string for tv shows).

May I suggest changing capital-G Guid to GuidList or something? So as not to break the behavior of integrations that depend on the existing guid field.

Also your docs are out of date since the capital-G Guid field doesn’t appear in them: https://support.plex.tv/articles/115002267687-webhooks/

Server Version#: 1.20.1.3252
Player Version#: N/A

1 Like

JSON is case sensitive!

Which isn’t to say it isn’t confusing. I agree, I wonder if it was deliberate. (Possibly, because not every consumer would expect multiple GUIDs?)

When Plex moved from third-party IDs to Plex GUIDs there was an outcry. The third-party IDs were added back in this version:

Plex Media Server - #360 by StSimm1

  • (Library) Store external ids for items in new Plex Movie libraries.

/following

JSON is case sensitive!

Sure it is, but it’s still a… bizarre decision.

In researching this bug I learned a bunch about how Golang’s built in json library handles case and it’s not pretty. Turns out order matters more than case for instance. Here’s the fix I ended up with after an embarrassing amount of trial and error lol

It is good news the external guids are back now though, I’ve been matching on title and year.

1 Like

This will make you feel better, then. Or worse? :slight_smile:

https://i.redd.it/u8egpulvmr131.png

Edit: I just realized that I pronounce ‘Guid’ and ‘guid’ differently in my head.

1 Like

Anyone from Plex willing to weigh in?

Bump. @trumpy81 @ChuckPa @anon18523487 y’all seem to work for Plex and have responded to topics lately, any chance you can help get this bug fixed?

I don’t have any knowledge on webhooks but I’ve ping the team to see if I can get an answer.

3 weeks later, any update?

Another three weeks. Why do you bother having this forum if you don’t check it?

@anon18523487 did you even ping anyone?

Sorry, I thought I provided an update. I did talk to the devs and was told this is correct. Using JSON is case sensitive.

Wow that’s disappointing. So you’re just gonna have two fields with the same name? Did you actually talk to anyone, because I’m sure if you brought that up to a real dev they’d see the obvious issue.

If you’re not gonna fix it, is the plan to just leave the docs wrong? Not that I’d be surprised at this point I guess, just disappointed.

@anon18523487 docs are still wrong…

@anon18523487 Maybe you can’t find the link to the docs? Here they are again: https://support.plex.tv/articles/115002267687-webhooks/

Note how there’s only one “guid” field and all the fields are lowercase.

I don’t see where that doc mentions guid. Maybe I’m missing it. Either way, like you say, the correct use is lowercase, so that’s what should be used. If you have an app or something that is using “Guid”, they are doing it wrong.

Then why is YOUR app sending capital “Guid?” Doesn’t that mean you are doing it wrong? This is the whole point of this post, Plex is sending two different fields called “guid” and “Guid.”

Is there someone else you can get to look at this? Clearly you don’t understand what’s going on.

I’m gonna try to explain this differently so hopefully someone coming across can get it.

Here is a full webhook payload generated today by Plex: Full webhook response · GitHub

This payload is generated by Plex. Plex produces this data structure and then sends it to my app, so the data in this payload is the responsibility of Plex.

Under the Metadata key, there are two different fields called “guid,” I’ve screenshotted them here:

The lowercase one:

The uppercase one:
Screen Shot 2021-01-24 at 9.51.34 AM

Note how these are not interchangeable. Not only do they refer to different guids, they’re different data types. One is a simple string, the other is an array of objects. This capital “Guid” field does not appear in the example payload in the documentation (search “Example Payload”). That’s what I mean when I say the docs are wrong. There’s actually a lot of differences between the example payload and a real world payload, so that page definitely needs to be looked at.

You can also confirm yourself that these two fields appear next to each other under Metadata by reading the gist that I linked. Here it is again. I understand it’s difficult to read but please bear with me.

Now you’ve said the following:

However, this payload that, again is generated by Plex is producing both a lower case and an upper case field name.

So according to you Plex is doing something wrong here. I promise I’m not picking on you, but I can’t figure out any other way to contact someone on Plex. Believe me, I wish I wasn’t here arguing with a forum moderator about API spec either, but this is the choice your company has made.

I’m gonna tag some other people so hopefully someone can get this in front of the right people: @trumpy81 @ChuckPa @tom80H @TeknoJunky PLEASE pass this along to developers, I promise you they’ll get it even if it doesn’t make sense to you.

I’ve passed along a link to your post, it will get reviewed and if necessary responded to and/or corrected, as appropriate.

I’d recommend caution if any changes to the implementation are considered at this point; popular third-party tools (such as Tautulli and Trakt) now rely on the existing naming for external, globally unique identifiers.

@pshanew I agree, though those projects changed quickly to deal with the issue they’ll have no trouble changing to handle it being fixed. We shouldn’t hold back from improving the API just because others had to work around it already. I’m going to have to modify my projects if/when this is fixed too.

Thanks @TeknoJunky

Oh, I get it now. Sorry, webhooks is not part of my wheelhouse. Had to learn a few things.

As you found out. “guid” is a single response. “Guid” is an array response. This is Plex’s format on differentiating the types. I was told that although this is odd, it is technically correct.

The support articles were written when webhooks was first released. That “Guid” response did not exist at the time. This was added to handle the new Plex Movie agent. Users asked to return the different original source ids so tools like Tautulli can match the movie/show back to the source since Plex’s new “guid” wouldn’t match. I can help get the article updated, but getting the API changed will take someone higher up than me.

Is your tool not able to pick these out and use them correctly?