/posts.json?before=X returns the first 50 posts with an ID lower than X. So if you want the get the lastest 75 posts for example, you can do:
- GET
/posts.jsonto get the last 50 - GET
/posts.json?before=xwhere x is the ID of the oldest post in the set of the previous GET call. - Get the first 25 posts of this last GET set and you’ll have the 75 you wanted.
In my case I needed all the posts from the last 24hs, so my code looks like:
- GET
/posts.jsonto get the last 50. - If the oldest post in the set returned by the previous GET was created between the last 24hs, I do GET
/posts.json?before=xwhere x is the ID of the oldest post in the set of the previous GET call. - Repeat until the GET call returns at least 1 post that was created more than 24hs ago.
Hope this helps anyone ![]()