fetch('https://dummyapi.online/api/movies') .then((response) => response.json()) .then((json) => console.log(json));
import requestsimport json response = requests.get('https://dummyapi.online/api/movies')if response.status_code == 200: data = json.loads(response.text) print(data)
[ { 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/' }, ...]
Getting a single entry of a certain resource. In this example, we use the /api/movies/1 route.
/api/movies/1
fetch('https://dummyapi.online/api/movies/1') .then((response) => response.json()) .then((json) => console.log(json));
import requestsimport json response = requests.get('https://dummyapi.online/api/movies/1')if response.status_code == 200: data = json.loads(response.text) print(data)
{ id: 1, movie: 'The Shawshank Redemption', rating: 9.2, image: 'images/shawshank.jpg', imdb_url: 'https://www.imdb.com/title/tt0111161/'}