[Instagram] How to get more than 60 images from Instagram service


Recently, I have created an app that uses instagram images ,.( I made this app for other guy, so i can not reveal it here ).
The problem is that , Instagram only returned first 60 images per returned pack. So if you have more than 60 images, and you want to get these older images, you must find out some way to deal with that. And here is what I did in my app.

It turned out  Instagram provided us a pagination mechanism to get each 60 images, The first request will return 60 newest images, then you then the oldest id of images returned from previous pack.
Just add token “max_id” with the token’s value is the oldest image id:
For example, this is how I create my JSONObject for request more images.
JSONObject feedJson = executeHttpGet("https://api.instagram.com/v1/users/"
+ userId
+ "/media/recent/"
+ "?access_token="
+ token
+ "&count=" + mediaCount
+ "&max_id=" + mOldestId);

The excuteHttpGet is my private method based on HttpClient and HttpResponse to send get read the response from server.

That’s it.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: