简体   繁体   中英

How to get all reviews in themoviedb api?

I am creating a rest api , I would like to retrieve or get all reviews/comments which are in a database.

This is what I have done :

app.get('/review', (req, res) =>{
        request('https://api.themoviedb.org/3/review?api_key=4d9c9de3bdf0d3b6837c49c086e3b190', function (error, response, body) {
            console.log('error:', error); // Print the error if one occurred and handle it
            console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
            res.send(body)
          });
    });

I am getting this error: {"status_code":34,"status_message":"The resource you requested could not be found."}

what am I doing wrong here? help

Note: other methods works perfectly

This isn't a JS error or anything. If you look at the API Documentation , status_code: 34 means you're accessing an endpoint that doesn't exist .

Diving into the docs a bit further, you can't get ALL the reviews in the database. All you can do is get the reviews on a per movie basis. Try this URL:

https://api.themoviedb.org/3/movie/401478/reviews?api_key=4d9c9de3bdf0d3b6837c49c086e3b190

Here's the documentation on the /movie/<movie_id>/reviews endpoint: https://developers.themoviedb.org/3/movies/get-movie-reviews

There is also the /review/<review_id> end point, but it appears that gets a single review by id which probably isn't what you're looking for: https://developers.themoviedb.org/3/reviews/get-review-details

It has nothing to do with nodeJS .As stated by @VicJordan, the problem is only with the url you are trying to search, it's simply not a valid API request. Try to go thru API documentation to find out how to use them. An example of a valid URL would be:

https://api.themoviedb.org/3/discover/movie?api_key=4d9c9de3bdf0d3b6837c49c086e3b190

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM