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:
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.
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.
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.
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.
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:
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’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.
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?