Suporte do The Movie Database

I was trying to use the id field as a unique id for an android list but quickly realized the id is repeated based off the type of credit (movie vs tv for instance). I created my own combining the id and media_type fields but after looking at the response again I noticed the credit_id field. Can anyone confirm that this field is unique across all endpoints or should I stick with my current implementation? I appreciate any help I can get.

4 respostas (na página 1 de 1)

Jump to last post

@WilderApps said:

I was trying to use the id field as a unique id for an android list but quickly realized the id is repeated based off the type of credit (movie vs tv for instance). I created my own combining the id and media_type fields but after looking at the response again I noticed the credit_id field. Can anyone confirm that this field is unique across all endpoints or should I stick with my current implementation? I appreciate any help I can get.

If I understand your question correctly...

Yes, the IDs are unique. There are no two Movies with the same ID.
But there may be a TV Show with the same Movie ID. Or a person.
The list of IDs are separate, different.

For example, ID 500:
https://www.themoviedb.org/movie/500-reservoir-dogs
https://www.themoviedb.org/tv/500-mad-about-you
https://www.themoviedb.org/person/500-tom-cruise
https://www.themoviedb.org/network/500
https://www.themoviedb.org/company/500

You can discern the difference between each media type
by looking at the media_type field returned with each object.

I appreciate the reply, but that's not what I was looking for. Admittedly, I didn't explain my problem that well either. Let me try again.

I am creating an Android app that, as part of the app, will display the credits for a person. I originally designed the credit object off of the knownFor array from the Search - People endpoint. Once a person is selected, I then pull their credits from the Combined Credits endpoint. The lists in android require a unique identifier for the objects in the list so I used the id field for the credit object. I realized these weren't unique because the data was pulled from different tables in the database (much as your example points out) after, by pure luck, pulling Steven Spielberg's credits. He is the director of both The Color Purple and an episode of Columbo. I fixed this by creating a listId field for my credit object, which I set to id + movie_type. His credits in my app then changed from 2 ids of 873 to 873movie and 873tv, respectively.

I have decided to implement a history feature that will function offline, saving any previously searched people and credits to a local database. I realized this fix wouldn't work for the database as anyone credited to the same project would have the same listId. I could easily do a joined primary key of the person and either the project (movie or tv show) or credit ids to solve the database issue. I would still need to make the listId to use in the app itself, though. After looking at the Combined Credits endpoint in more depth, I realized I had overlooked the credit_id field in building my credit object the way I did. Steven Spielberg's The Color Purple credit_id is 52fe4285c3a36847f80257ad for example. I could add this to my credit object and use it as the unique field for both my database and in-app lists, assuming this field is unique across all media_types. My question is, can anyone confirm this field to be unique across all media_types? Thanks again for any help I can get!

I looked through the API endpoints more thoroughly after posting the above reply and found the Credit - Details endpoint. This takes a credit_id and returns information about the person and project (listed as media in the response) associated with the credit_id. It confirms these are unique across media_types as it will return only one result. Thanks again for your response and I'll try to do a better initial job of looking through the endpoints before posting in the future.

I was researching this question this morning.
And in fact the credit_id refers only and exclusively to that combination of Actor+Character.
I was able to confirm this by looking at the response to this API Request.

https://api.themoviedb.org/3/person/6818/combined_credits?api_key=THE_KEY&language=pt-BR

The ID is different for each item.
But you already found the answer.
Sorry for being late.

Não consegue encontrar um certo filme ou série? Inicie sessão e adicione-o.

Geral

s focus the search bar
p abrir menu do perfil
esc close an open window
? open keyboard shortcut window

Em páginas de Média

b go back (or to parent when applicable)
e ir para a página de edição

Em páginas de temporadas de séries

(seta para a direita) ir para a próxima temporada
(seta para a esquerda) ir para a temporada anterior

Em Páginas de Episódios de Séries

(seta para a direita) ir para o próximo episódio
(seta para a esquerda) ir para o episódio anterior

Em Todas as Páginas de Imagens

a abrir janela para adicionar imagem

Em Todas as Páginas de Edição

t open translation selector
ctrl+ s submit form

Em Páginas de Discussão

n criar uma nova discussão
w toggle watching status
p toggle public/private
c toggle close/open
a abrir actividade
r reply to discussion
l ir para a última resposta
ctrl+ enter submit your message
(seta para a direita) página seguinte
(seta para a esquerda) página anterior

Definições

Deseja classificar ou adicionar este item a uma lista?

Iniciar Sessão

Ainda não é um membro?

Crie uma Conta e Adere a Comunidade