The Movie Database Support

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

3 replies (on page 1 of 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.

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login