1
votes

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).

1
are u in sandbox mode?, if so u will not get pagination, u can only get 20 posts in API response in sandbox mode, when u go live u will get all posts and paginationkrisrak
yes, i'm in sandbox mode, but even in sandbox i get the pagination in the media/recent endpoint thoLoucry
yes, but in sandbox, pagination will not work, u only get max of 20, which will be in first API response without any need for max_id. pagination will not work in sandbox, this is expected behaviorkrisrak
yes, it was a sandbox problem, please post this as an answer so i can mark it as resolved, thanks! the only issue now is the count, it returns a seamingly random number of postsLoucry

1 Answers

0
votes

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.