我正在向用户/媒体/最近的 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
}
});
Run Code Online (Sandbox Code Playgroud)
另一种方法是使用min_id和的组合max_id来获取一系列媒体。但是,它看起来排除或不显示 和 的 min_id媒体max_id。这意味着只有 和 之间的媒体min_id才会max_id返回给您。
| 归档时间: |
|
| 查看次数: |
1281 次 |
| 最近记录: |