Shivangi
Shivangi

Reputation: 93

Generate movies from OMDB API

I am trying to view all the movies from IMDB. I am unabke to do it. THerefore I decided to use a search bar that will send the string of the name of the movie and then show the movies of that string. But it gives me error even though I generated the key.

Here is the snippet, Please help!

axios.get('http://www.omdbapi.com/?i=tt3896198&apikey=5657bf65'+searchText) What have I done wrong in the code?

Also if possible, please tell me the code to view all the movies in imdb starting from the recent without any search query.

Upvotes: 0

Views: 1442

Answers (2)

akhtarvahid
akhtarvahid

Reputation: 9769

As I see you are using search API but calling isn't correct.

pass &search like this

axios.get(http://www.omdbapi.com/?i=tt3896198&apikey=5657bf65&search=searchText)

you need to pass your searched movie name like this

axios.get(`http://www.omdbapi.com/?i=tt3896198&apikey=5657bf65&search=${pass searched movie name}`);

Upvotes: 0

ptothep
ptothep

Reputation: 395

I dont think omdbapi has the option to display all videos, but for the search you can use it like this:

axios.get('http://www.omdbapi.com/?apikey=5657bf65&s='+searchText)

Upvotes: 1

Related Questions