Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

api

instagram

I'm making a request to users/media/recent GET endpoint, but it's ignoring my min_id parameter. My final request looks like this (replace with your own access_token to test):

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

Results return, but the min_id is ignored and all posts are returned from the most recent one.

How do I make the Instragram API take my min_id parameter into account?

like image 944
LeonardChallis Avatar asked Nov 08 '22 14:11

LeonardChallis


1 Answers

Through first hand experience, unfortunately, Instagram API only returns the most recent media back to you no matter what the min_id is. A work around is to find and only use the max_id of the media instead. You may wish to save it to an array so that later you use can just pull out the 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
        }
    });

Another way is to use the combination of min_id and max_id to get you a range of media. However, it looks like it excludes or doesn't show the media of the min_id and max_id. That means only media between min_id and max_id are returned to you.

like image 199
HuorCulnamo Avatar answered Nov 15 '22 13:11

HuorCulnamo