Hit Movies
Learn and practice how to get popular, top-rated, and trending movies using TMDB API.
We'll cover the following...
In this lesson, we’ll explore and practice three endpoints— popular, top-rated, and trending movies.
Popular movies
It always helps to have a list of popular movies to choose from especially when we plan to watch a movie after a long time.
We can get a list of the current popular movies on TMDB using the popular movies endpoint. To keep the list up-to-date, the content is updated daily. The endpoint doesn’t take any path parameter other than the API key.
Here is the base URL in focus:
https://api.themoviedb.org/3/movie/popular?api_key={ourTMDBapikey}
The following query parameters can be used with this endpoint:
Name | Type | Category | Description |
| string | optional | This is an |
| integer | optional | This is used to specify which page to query. Its value can be in a range 1–1000 inclusive. The default value is |
| string | optional | This is to specify a |
The output JSON response consists of the following objects:
Object | Type | Category | Description |
| integer | optional | This is the page being queried. |
| array[object] | optional | This returns all the popular movies (with their details) on the specified page such as 21 movies on page 1, then 20 movies on page 2, and so on. |
| integer | optional | This is the total number of pages having popular movies on TMDB. |
| integer | optional | This is the total number of popular movies on TMDB. |
The widget below has the code to get a list ...