I don’t think there is an endpoint for that. It has pagination so you might be able to loop and keep incrementing the page number until the API returns whatever it returns when there are no more pages and just build your own object out of that. But if you are using a free key I suspect you will hit the daily limit pretty fast.
I’m not really sure why you would want such a huge object to work with (all movies are a lot of movies).
Before implementing the pagination I need to grab all movie results. Then I can render movies on multiple pages. I know there is way around it I have looked at the documentation and there is nothing I can find.
I mean the API has pagination, here is the example they give http://www.omdbapi.com/?s=Batman&page=2.
So you would just keep querying the same endpoint and increment the page number on each loop iteration until it doesn’t return any more results and in the process build out an object with all the results.
Yes, and each page will give you 10 results back (or whatever). So you start at page 1 (or 0 not sure) and fetch, then increment the number and fetch again, and so on, until there are no more pages. You construct an object and for each fetch result, you keep adding to that object. In the end, you will have an object with all the results from all the pages.
// Pseudo-ish code
let page = 1;
loop
fetch -> http://www.omdbapi.com/?s=${searchTerm}&page=${page}
add result to object
page++
if no more results end loop
I have wrapped code in while loop but still returns 10 movies while (page <= 5) { const res = await axios({proxy}http://www.omdbapi.com/?
apikey={apiKey}&s={this.query}&type=movie&page={page}); this.result = res.data; page++; }
I am trying to get all movies but the API only returns 10 movies. Any help would be appreciated. I have tried to wrap my code in while loop and incrementing the page by 1 so to get return more movies but still doesnt seem to work.