I am trying to get all the recent media by tag using this Instagram endpoint. The purpose here is to track all the recent media for tags. I have configured a scheduled task (with Java and Spring) (to execute every hour) that sends requests and gets data. Below is the execution sequence:
If you want most recent don't use
max_tag_id, If you use
max_tag_id it will return all media dated before that.
You need to get the
min_tag_id and store it, in the next hour start by making call with only
min_tag_id, if there is
pagination.next_url, use that to get next set of 20, until
pagination.next_url does not exist.... use the stored
min_tag_id to make calls the next hour.
The very first time you make call without
You can also set the
&count=32, to get 32 posts with every API call, (32 is max from my experience)