为什么 Instragram API 忽略我请求的 min_id 参数?

Why is the Instragram API ignoring the min_id parameter for my request?

我正在向 users/media/recent GET 端点发出请求,但它忽略了我的 min_id 参数。我的最终请求如下所示(替换为您自己的 access_token 进行测试):

https://api.instagram.com/v1/users/self/media/recent/?access_token=xxxxxxxx.xxx92d6.6584xxxxxe4d03a3cf2xxxcdb7da&min_id=1162106936627841123_10443137

结果 return,但 min_id 被忽略,所有帖子都是 return 最近的帖子。

如何让 Instragram API 考虑我的 min_id 参数?

通过第一手经验,不幸的是,无论 min_id 是什么,Instagram API 只会 returns 返回给您的最新媒体。解决方法是查找并仅使用媒体的 max_id。您可能希望将其保存到一个数组中,以便以后使用时只需拉出 max_id:

$.ajax({
        type: "GET",
           //min_id endpoint does not work for instagram API 
           //as it will always return the most recent photos. 
           //Using the max_id and going backward is the only workaround. 
           //Therefore accessing the max_id from the array that was saved earlier
        url: "https://api.instagram.com/v1/users/"+ instagram_id +"/media/recent/?access_token=" + token + "&count=" + count +"&max_id=" + pageArray[currentPage-2], 
        dataType: "jsonp",
        jsonp: "callback",
        success: function(obj) {
          //do something        
        },
        error: function() {
          //do something
        }
    });

另一种方法是结合使用 min_idmax_id 来获得一系列媒体。但是,它似乎排除或不显示 min_idmax_id 的媒体。这意味着只有 min_idmax_id 之间的媒体会返回给您。