Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram api count not working

I am trying to do an api call to get 10 of my posts, but it returns only 1 post, I have been using the jquery code to do the api call:

$.ajax({
  url: 'https://api.instagram.com/v1/users/6372114628/media/recent',
  dataType: 'jsonp',
  type: 'GET',
  data: {
    count: num_photos,
    access_token: accesstoken
  },
  success: function(data2) {
    for (var i = 0; i < data2.data.length; i++) {
      $(element).append('<li><a href="' + data2.data[i].link + '" target="_blank"><img src="' + data2.data[i].images.low_resolution.url + '"></a></li>');

      //$(element).append('<li><a href="'+ data2.data[i].link +'" target="_blank" style="background-image:url('+data2.data[i].images.low_resolution.url+'); background-size:cover;"></a></li>');
    }
  },
  error: function(data2) {
    $(element).append('<li>' + data2 + '</li>');
  }
});

Which returns this:

https://api.instagram.com/v1/users/6372114628/media/recent?callback=jQuery1124040077233742195983_1522982885182&count=10&access_token=6372114628.890c38a.4e03aa92b121459c84e893c54c3c0ce1&_=1522982885183

What am I doing wrong? I am only getting 1 post, I am expecting 10. I have been trying to fix this for a month now and I am not getting anywhere close. I hate this stupid thing.

I have another friend and I was able to setup her Instagram no problem:

https://api.instagram.com/v1/users/1960989467/media/recent?access_token=1960989467.1677ed0.6ab08c98b04c4b5bac6410ed045a6dbc&count=9&callback=instafeedCache35472b641655efc8.parse

Returns 9 items as expected. This makes no sense what so ever. How is one working and the other is not?

Sincerely, A very frustrated developer.

like image 475
user979331 Avatar asked Mar 30 '18 03:03

user979331


1 Answers

I have exactly the same issue as you. For some accounts unfortunately they do not return full list of images. If you add new image to given account most probably it will appear in Instagram API.

What I believe it is a bug on Instagram old API. Unfortunately it is not possible to notify Instagram developers about this bug, as bug report program for old API is closed. They accept tickets only for new Graph API.

IMHO it is nothing you can do at this point. It does not matter which plugin you are using. It is broken for some of the Instagram accounts. As old Instagram API will be deprecated soon, I would suggest slowly moving to new Graph API. Old API was buggy recently. I'm using it a lot and I had such situation few times. Newly added images are appearing in responses from API, however it is not possible to fetch older images.

like image 122
Astaz3l Avatar answered Sep 28 '22 15:09

Astaz3l