# Api to fetch topic by page

**URL:** <https://meta.discourse.org/t/api-to-fetch-topic-by-page/63342>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [May 25, 2017, 8:51am UTC](https://meta.discourse.org/t/api-to-fetch-topic-by-page/63342 "2017-05-25T08:51:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [May 25, 2017, 1:35pm UTC](https://meta.discourse.org/t/api-to-fetch-topic-by-page/63342/2 "2017-05-25T13:35:08Z")

</div>

Are you trying to get all the posts that belong to a topic?

This would be a good feature to add to the discourse\_api ruby gem rather than making raw api calls. There is no “Next Page” api call. What you will need to do to get the “next page” is to look at the `post_stream` part of the response:

 ![](https://global.discourse-cdn.com/meta/original/3X/8/a/8a386729157f67a290ca758d75069ed16aabb803.png)

And then you will need to call the [`/t/{id}/posts` endpoint](https://docs.discourse.org/#tag/Topics%2Fpaths%2F~1t~1%7Bid%7D~1posts.json%2Fget) and pass in a list of post\_id’s:

 ![](https://global.discourse-cdn.com/meta/original/3X/4/9/49a6ba053c8494d924069e5eff1c4f3b2e2e9d26.png)

I would recommend opening up the chrome dev tools and looking at the xhr requests on a long topic here on meta to learn how this works.

---

_[View the full topic](https://meta.discourse.org/t/api-to-fetch-topic-by-page/63342)._
