Search code examples
iosinstagram

Instagram and iOS. Get photo with a lot of likes with current user


I am using Instagram API.

My query is:

api.instagram.com/v1/users/[USER_ID]/media/recent?count=3818

I get only 33 photos that is ordered by date

But, I need to load all the user's photo which has more likes.

What am I missing here?


Solution

  • You can use Pagination.See http://instagram.com/developer/endpoints/ for information on pagination. You need to subsequentially step through the result pages, each time requesting the next part with the next_url that the result specifies in the pagination object.

    From instagram

    pagination

    Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next set of data.

    { ... "pagination": { "next_url": "https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296", "next_max_id": "13872296" } }

    On views where pagination is present, we also support the "count" parameter. Simply set this to the number of items you'd like to receive. Note that the default values should be fine for most applications - but if you decide to increase this number there is a maximum value defined on each endpoint.