...

/

Latest and Upcoming Movies

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.

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

language

string

optional

This is an ISO_3166_1 code used to get the translated data as per the specified language. This is applicable to only the fields that support it. The default value is en-US.

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.

Press + to interact
Please provide values for the following:
API_KEY
Not Specified...
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 response
printResponse(response);
} catch (error) {
// Call to function that prints the error message, if any
printError(error);
}
}
// Call to function that makes API call
fetchData();

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 ...