„The Movie Database“ palaikymas

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

3 atsakė (on page 1 iš 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.

Negalite rasti filmo ar TV laidos? Prisijunkite, kad sukurtumėte.

Bendras

s susitelkti į paieškos juostą
p profilio meniu
esc uždarykite atidarytą langą
? spartieji klavišai

Medijų puslapiuose

b grįžkite atgal (arba tėvams leidus)
e į redagavimo puslapį

TV sezono puslapiuose

(dešinė rodyklė) sekantis sezonas
(kairė rodyklė) ankstesnis sezonas

TV epizodo puslapiuose

(dešinė rodyklė) sekantis epizodas
(kairė rodyklė) ankstesnis epizodas

Visuose atvaizdžio puslapiuose

a atverti atvaizdžio pridėjimo langą

Visuose redagavimo puslapiuose

t vertimo parinktys
ctrl+ s pateikti formą

Diskusijų puslapiuose

n sukurti naują diskusiją
w perjungti peržiūros būseną
p perjungti viešasis / privatus
c perjungti uždaryti / atidaryti
a peržiūrėti aktyvumą
r atsakyti į pokalbį
l į paskutinį atsakymą
ctrl+ enter pateikti pranešimą
(dešinė rodyklė) sekantis puslapis
(kairė rodyklė) ankstesnis puslapis

Nustatymai

Norite įvertinti ar įtraukti šį elementą į sąrašą?

Prisijungti