Axuda de The Movie Database

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

3 respostas (na páxina 1 de 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.

Non podes atopar unha película ou serie? Inicia sesión para creala.

Global

s amosar a barra de procura
p abrir menú do perfil
esc pechar e abrir xanela
? abrir xanela de atallos do teclado

En páxinas de medios

b atrás (ou á principal se aplica)
e ir a editar páxina

En páxinas de tempadas de televisión

(flecha dereita) ir á tempada seguinte
(flecha esquerda) ir á tempada anterior

En páxinas de episodios de televisión

(flecha dereita) ir ao episodio seguinte
(flecha esquerda) ir ao episodio anterior

En todas as páxinas de imaxe

a abrir a xanela de engadir imaxe

En todas as páxinas de edición

t abrir selector de traducións
ctrl+ s enviar formulario

Nas páxinas de debate

n crear un novo debate
w amosar o estado do seguimento
p mudar público/privado
c mudar abrir/pechar
a abrir actividade
r responder no debate
l ir á última resposta
ctrl+ enter eviar a túa mensaxe
(flecha dereita) páxina seguinte
(flecha esquerda) ir á páxina anterior

Configuración

Queres valorar ou engadir o elemento a unha listaxe?

Iniciar sesión