# How to get more posts from posts.json

**URL:** <https://meta.discourse.org/t/how-to-get-more-posts-from-posts-json/84472>\
**Category:** Development\
**Created:** [4월 3, 2018, 3:33오후 UTC](https://meta.discourse.org/t/how-to-get-more-posts-from-posts-json/84472 "2018-04-03T15:33:09Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Dalmiro\_Granas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dalmiro_granas/32/111811_2.png) [@Dalmiro\_Granas](https://meta.discourse.org/u/Dalmiro_Granas)\
**Post date:** [9월 26, 2018, 4:06오후 UTC](https://meta.discourse.org/t/how-to-get-more-posts-from-posts-json/84472/6 "2018-09-26T16:06:04Z")

</div>

`/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:

1. GET `/posts.json` to get the last 50
2. GET `/posts.json?before=x` where x is the ID of the oldest post in the set of the previous GET call.
3. 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:

1. GET `/posts.json` to get the last 50.
2. If the oldest post in the set returned by the previous GET was created between the last 24hs, I do GET `/posts.json?before=x` where x is the ID of the oldest post in the set of the previous GET call.
3. Repeat until the GET call returns at least 1 post that was created more than 24hs ago.

Hope this helps anyone 🙂

---

_[View the full topic](https://meta.discourse.org/t/how-to-get-more-posts-from-posts-json/84472)._
