我正在向 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
结果返回,但
min_id
被忽略,所有帖子都从最近的帖子返回。如何让 Instragram API 使用我的
min_id
参数考虑?
最佳答案
不幸的是,通过第一手经验,Instagram API 只会将最近的媒体返回给您,无论是什么min_id
是。解决方法是查找并仅使用 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_id
的组合和 max_id
为您提供一系列媒体。但是,它似乎排除或不显示min_id
的媒体。和 max_id
.这意味着只有 min_id
之间的媒体和 max_id
被退回给你。
关于api - 为什么 Instagram API 会忽略我请求的 min_id 参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37596076/