Skip to content

Movies

Fetch all movies

fetch('https://dummyapi.online/api/movies')
.then((response) => response.json())
.then((json) => console.log(json));
Output
[
{
id: 1,
movie: 'The Shawshank Redemption',
rating: 9.2,
image: 'images/shawshank.jpg',
imdb_url: 'https://www.imdb.com/title/tt0111161/'
},
{
id: 2,
movie: 'The Godfather',
rating: 9.2,
image: 'images/godfather.jpg',
imdb_url: 'https://www.imdb.com/title/tt0068646/'
},
...
]

Fetch a single movie

Getting a single entry of a certain resource. In this example, we use the /api/movies/1 route.

fetch('https://dummyapi.online/api/movies/1')
.then((response) => response.json())
.then((json) => console.log(json));
Output
{
id: 1, movie: 'The Shawshank Redemption',
rating: 9.2, image: 'images/shawshank.jpg',
imdb_url: 'https://www.imdb.com/title/tt0111161/'
}