Supporto 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 risposte (nella pagina 1 di 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.

Non riesci a trovare un film o una serie Tv? Accedi per crearlo.

Globale

s focalizza la barra di ricerca
p apri menu profilo
esc chiudi una finestra aperta
? apri finestra scorciatoia tastiera

Su tutte le pagine di media

b torna indietro (o al precedente quando applicabile)
e vai alla pagina di modifica

Nelle pagine delle stagioni TV

(freccia destra) vai alla stagione successiva
(freccia sinistra) vai alla stagione precedente

Nelle pagine degli episodi TV

(freccia destra) vai all'episodio successivo
(freccia sinistra) vai all'episodio precedente

Su tutte le pagine di immagini

a apri finestra aggiungi immagine

Su tutte le pagine di modifica

t apri selettore traduzione
ctrl+ s invia modulo

Sulle pagine di discussione

n crea nuova discussione
w segna come visto/non visto
p cambia publico/privato
c cambia chiuso/aperto
a apri attivita
r rispondi alla discussione
l vai all'ultima risposta
ctrl+ enter invia il tuo messaggio
(freccia destra) pagina successiva
(freccia sinistra) pagina precedente

Impostazioni

Vuoi valutare o aggiungere quest'elemento a una lista?

Accedi