7

Lets asume I fetch recent user media for a tag... And that I am able of storing in a database the information that it is returned to me by the API.

The media ids are something like [0-9]+_[0-9]+, and lets asume that one day later, I want to fetch only new data, so I order the media, that I stored in my DB, by instagram's created time, then I select the one that its the newest and grab its id something like '121231232213123_12312312312'.

Then I use that Id as the max_id attribute for the API endpoint https://api.instagram.com/v1/tags/{tag_name}/media/recent, I would assume, that I would get new user_media or an empty array if no one had upload anything.

The thing is that I receive all the same data, its like if it not filtering my results nor using the max_id.

is this correct behavior or should I do something else?

thanks,

ps: I posted this same issue also on google groups:

https://groups.google.com/forum/?fromgroups#!topic/instagram-api-developers/QyjCORkjr3I

chopi321
  • 1,383
  • 1
  • 11
  • 23
  • Max and MIn ID are used to parse through the paginated data response, they aren't parameters for the actual query to the API. – Jack Marchetti Feb 21 '15 at 19:58

1 Answers1

4

I found 2 tips, that can be useful for you:

  1. You should use min_id, in order to get new media. max_id will return photos, older that the one with this id.
  2. It's better to use live API in order to update your DB with new photos dynamically.

UPDATE:

Instagram live API is deprecated now. However you can now use webhooks subscription system which is very similar to facebook. Details can be found in this answer.

Yaro
  • 570
  • 3
  • 20
  • Is there a way to get all photos from a month? – Mauro Dias Jul 07 '14 at 00:34
  • You always can iterate through the list of recent media & check the date (compare it with 1.month.ago or smth) – Yaro Jul 07 '14 at 09:24
  • how can i get the post data ? – Mauro Dias Jul 07 '14 at 17:24
  • 1
    By making request to Instagram API. After you made it you should get JSON with all the post data like this: http://pastebin.com/qmcPgyYM – Yaro Jul 08 '14 at 11:14
  • this created_time output is such freak for me ... "created_time" => "1404817910" - noticed this is a 2014 picture another created time => "1383952734" - and this a 2013 – Mauro Dias Jul 10 '14 at 19:06
  • 1
    NP, you can always use ruby Time.at(....) to get the exact time. For example Time.at(1404817910) gives 2014-07-08 11:11:50 +0000 for me :) – Yaro Jul 11 '14 at 11:46
  • Did any one figure out how to get images between a particular time range – pal4life Sep 15 '14 at 20:25
  • The link in your answer is now broken. – Ionut Necula Jul 12 '17 at 10:24
  • @Ionut The whole answer is Deprecated now actually. Over years API changes unlike stackoverflow answers :P . I'll update the answer with more recent link. – Yaro Jul 12 '17 at 14:47