Loucry
Loucry

Reputation: 23

Pagination with /locations/location-id/media/recent Instagram

I'm using https://api.instagram.com/v1/locations/{location-id}/media/recent endpoint of the Instagram API to fetch posts in a specific location, but i'm having an issue implementing pagination.

the request https://api.instagram.com/v1/locations/106970059456743/media/recent?ACCESS_TOKEN=(ACCESS_TOKEN)

the problem comes with the MAX_ID and MIN_ID parameters, because in the response i get from the first query the pagination object comes empty (see https://www.instagram.com/developer/endpoints/), i've tried pluggin in the id's of the most recent posts in the parameters and that doesn't seem to work when i'm asking for new posts, but it does work whem i'm asking for older post.

i've successfully implemented the pagination for the https://api.instagram.com/v1/tags/{tag}/media/recent endpoint but apparently this endpoints use different paginations (media/recent does return a pagination object in the response).

Upvotes: 1

Views: 539

Answers (1)

krisrak
krisrak

Reputation: 12952

If you are in Sandbox mode, you can only get 20 posts in API response in sandbox mode, pagination will not work in sandbox, this is expected behavior. When u go live mode u will get all posts and pagination.

Upvotes: 0

Related Questions