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:
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:
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.
Try plugin calls "instafeed.js". It is very easy to use.
Example :
You have to specify userId and accessToken or client_id.
var feed = new Instafeed({
get: 'user',
tagName: 'instafeed',
userId: userid,
accessToken: key,
resolution: 'standard_resolution',
target: 'feed-images', // Id of `enter code here`
limit: 10,
template: '<li><a class="fancybox" rel="gallery1" href="\{\{image\}\}"><img src="\{\{image\}\}" /></a></li>',
after: function () {
// Effect like slider of fanvybox
},
error: function (error) {
console.log(error);
}
});
feed.run();