Latest and Upcoming Movies
Learn and practice how to get the latest, upcoming, and currently playing movies and information about their duration using TMDB API.
We'll cover the following...
In this lesson, we’ll focus on four endpoints—the latest movie, upcoming movies, currently playing movies, and movie watch providers.
Latest movie
If an individual is looking for something new to watch then most probably they will start with the latest movies. TMDB’s latest movie endpoint allows us to fetch the latest movie they have on the platform. This endpoint doesn’t take any path parameters.
The base URL in focus is as follows:
https://api.themoviedb.org/3/movie/latest?api_key={ourTMDBapikey}
Request parameters
The following query parameters can be used with this endpoint:
Name | Type | Category | Description |
| string | optional | This is an |
Let’s run an example of the latest movie endpoint. The widget below shows how to get the most newly created movie. Click “Run” to execute the code.
import fetch from "node-fetch";const API_KEY = '{{API_KEY}}';const endpointUrl = new URL('https://api.themoviedb.org/3/movie/latest');const queryParameters = new URLSearchParams({api_key : API_KEY,language : 'en-US'});async function fetchData() {try {endpointUrl.search = queryParameters;const response = await fetch(endpointUrl);// Call to function that prints the responseprintResponse(response);} catch (error) {// Call to function that prints the error message, if anyprintError(error);}}// Call to function that makes API callfetchData();
We got the latest movie on TMDB in English. We can change the value of language on line 9 to get the latest show details in ...