cosenary / Instagram-PHP-API

An easy-to-use PHP Class for accessing Instagram's API.
http://cosenary.github.com/Instagram-PHP-API
BSD 3-Clause "New" or "Revised" License
1.46k stars 781 forks source link

getUserMedia() and pagination #202

Open mapmyphotos opened 8 years ago

mapmyphotos commented 8 years ago

Hi,

When I call getUserMedia() it will return only the latest 20 results. I have tried several ways to use pagination with this request but can't get it to work. Does getUserMedia() support pagination? What is the best way to get more that 20 results? Can you please provide a full example of how to use getUserMedia() with pagination to obtain all media.

Great library BTW, everything (except for this) was really easy to setup.

Thanks, Lachlan.

mapmyphotos commented 8 years ago

Hi,

I have done some more reading in the Instagram developer documents and found there are some limits on the API while your client is in Sandbox mode. This should be a note for everyone as it's a little bit confusing, but after digging through the docs about sandbox mode it all makes sense.

For reference here is a link to the docs about sandbox and api limits while in sandbox mode:

https://www.instagram.com/developer/sandbox/

I think your code might actually work correctly when my client goes out of sandbox mode, if not it should be easy to modify the code slightly and using the "max_id" parameter in the getUserMedia method (specifying the max id (id of the photo) should return the next set of results after that photo).