Sprijin Bază de date filme (The Movie Database)

How do I return the director, writer and limit to the first 10 cast members?

3 răspunsuri (pe pagina 1 din 1)

Jump to last post

Hi @jerauf You can call the /credits method to get all of that information. I would also suggest taking a read through the 'append_to_response' documentation to learn how you can make that call in a single request.

Cheers.

Thanks for the response, Travis. What I don't understand about this is how it will allow me to manipulate the data that's returned. With 'append_to_reponse', you're only appending specific requests, not the data.

I'm not sure if I understand what you mean. By using 'append_to_response' the extra requests gets returned in the same single response you are making. It appends the data to a field with the same name as the appended requests. So in the example '/credits', now there is a credits field.

https://api.themoviedb.org/3/movie/550?api_key=###&append_to_response=credits
{  
   "adult":false,
   ... 
"credits":{  
      "cast":[  
         {  
            "cast_id":4,
            "character":"The Narrator",
            "credit_id":"52fe4250c3a36847f80149f3",
            "id":819,
            "name":"Edward Norton",
            "order":0,
            "profile_path":"/iUiePUAQKN4GY6jorH9m23cbVli.jpg"
         },
         {  
            "cast_id":5,
            "character":"Tyler Durden",
            "credit_id":"52fe4250c3a36847f80149f7",
            "id":287,
            "name":"Brad Pitt",
            "order":1,
            "profile_path":"/kc3M04QQAuZ9woUvH3Ju5T7ZqG5.jpg"
         },
         ...
      ],
      "crew":[  
         {  
            "credit_id":"56380f0cc3a3681b5c0200be",
            "department":"Writing",
            "id":7469,
            "job":"Screenplay",
            "name":"Jim Uhls",
            "profile_path":null
         },
         ...
      ]
   }
}

I've truncated the response here obviously, because it's too long but you can see here, the credits field gets added and becomes part of the response.

So with the credits returned back, just iterate over the array selecting the first 10 items from the cast array, and then iterate over the crew array grabbing whatever job(s) you want to display.

Nu găsiți un film sau un serial? Autentificați-vă pentru a-l crea.

Globale

s focalizează bara de căutare
p deschide meniul profilului
esc închide o fereastră deschisă
? deschide fereastra cu scurtături de la tastatură

Pe paginile media

b mergi înapoi (sau la părinte atunci când este cazul)
e mergi la pagina de editare

Pe paginile sezoanelor filmelor seriale

(săgeată dreapta) mergi la sezonul următor
(săgeată stânga) mergi la sezonul precedent

Pe paginile episoadelor filmelor seriale

(săgeată dreapta) mergi la episodul următor
(săgeată stânga) mergi la episodul precedent

Pe toate paginile de imagini

a deschide fereastra pentru adăugarea de imagini

Pe toate paginile de editare

t deschide selectorul de traduceri
ctrl+ s trimite formularul

Pe paginile de discuții

n crează o discuție nouă
w comută starea de vizionare
p comută publică/privată
c comută închisă/deschisă
a deschide activitatea
r răspunde la discuție
l mergi la ultimul răspuns
ctrl+ enter trimite mesajul
(săgeată dreapta) pagina următoare
(săgeată stânga) pagina precedentă

Setări

Doriți să evaluați sau să adăugați acest articol într-o listă?

Autentificare