Nimeshka Srimal
Nimeshka Srimal

Reputation: 8940

Instagram API: Get the oldest images first based on tagname

I recently developed an app using the Instagram API, But I faced some problems with it. (I got struck)

This app is not calling the api and getting images in the real-time. Instead, it calls the api once a week and store images in the database based on a specific hashtag. I see that their api is designed in a way to call it in real time and pull images, because it has this "recent" in its url, and it only provides 20 results. So every time a user reaches the end, it will load the next 20, until u reach the end.

However, in my case, When I pull the images every week, at one point, I will reach to the oldest image, and from that point I will be stopped, because Im going from Newest to the oldest. So I want to get data as from oldest to newest.( Actually I want to get the opposite of what's offered by instagram.) They have not provided any option to sort them in their docs.

Im thinking of a solution for this, but I can't wrap my head around it. So I will be much thankful if you guys can direct me in the right path.

I searched Google, viewed old questions in SO, but I didn't find the answer.

Edit : Im planning to fetch data starting from the Oldest one like this. (Since I know the min_tag_id, because I ran this once completely).

https://api.instagram.com/v1/tags/my_tag/media/recent?&client_id=xxxxxxxxxxxxxxx&min_tag_id=1408983759354183

where min_tag_id is of the oldest image. So everytime I will be calling to the min_tag_id. Is it a good solution?

Upvotes: 0

Views: 4724

Answers (1)

Marcus
Marcus

Reputation: 21

Yes, using the min_tag_id and max_tag_id is the solution. Have a look at this answer: Instagram Search for a tag within particular date range

Upvotes: 0

Related Questions