簡體   English   中英

如何在themoviedb API中獲得所有評論?

[英]How to get all reviews in themoviedb api?

我正在創建rest api,我想檢索或獲取數據庫中的所有評論/評論。

這是我所做的:

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)
          });
    });

我收到此錯誤: {"status_code":34,"status_message":"The resource you requested could not be found."}

我在這里做錯了什么? 救命

注意:其他方法效果很好

這不是JS錯誤或其他任何錯誤。 如果您查看API文檔status_code: 34表示您正在訪問不存在的端點。

再深入研究一下文檔,您將無法獲得數據庫中的所有評論。 您所能做的就是獲得每部電影的評論。 試試這個網址:

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

這是/movie/<movie_id>/reviews端點上的文檔: https : //developers.themoviedb.org/3/movies/get-movie-reviews

還有/review/<review_id>端點,但是似乎可以通過id獲得單個評論,這可能不是您想要的: https : //developers.themoviedb.org/3/reviews/get -審查-細節

它與nodeJS 。正如@VicJordan所說,問題僅在於您要搜索的url ,這根本不是有效的API請求。 嘗試瀏覽API文檔以了解如何使用它們。 有效URL的示例為:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM