Ryan
Ryan

Reputation: 22227

Instagram API: Is it possible to get a tagged photo from a certain date?

I'd like to get one photo with a certain tag from each day of the year. I know it's easy to fetch photos of a certain tag, but I haven't found a way to get just one from a certain date. Is this possible?

Cheers, Ryan

Upvotes: 0

Views: 2649

Answers (1)

Marcy Sutton
Marcy Sutton

Reputation: 917

They don't appear to give you that combination of parameters in a single endpoint. One approach might be to fetch images from the tags/tag-name endpoint and filter them client-side with the timestamps that are returned with the rest of the response. But whether you get a match depends if there's an image with the timestamp you're looking for--which in the case of January 1 to December 31, isn't likely.

GET /tags/tag-name/

http://instagram.com/developer/endpoints/tags/

https://api.instagram.com/v1/tags/nofilter?access_token=ACCESS-TOKEN

GET /media/search/

For a proper date query, you could use the Instagram API's media/search endpoint and filter by timestamp. Perhaps the image response will come back with tags, and you can filter by those client-side?

http://instagram.com/developer/endpoints/media/

"Search for media in a given area. The default time span is set to 5 days. The time span must not exceed 7 days. Defaults time stamps cover the last 5 days. Can return mix of image and video types."

MIN_TIMESTAMP A unix timestamp. All media returned will be taken later than this timestamp.

MAX_TIMESTAMP A unix timestamp. All media returned will be taken earlier than this timestamp.

https://api.instagram.com/v1/media/search?min_timestamp=XXXXXX&max_timestamp=XXXXXXX&access_token=ACCESS-TOKEN

Upvotes: 2

Related Questions