Api to fetch topic by page

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:

And then you will need to call the /t/{id}/posts endpoint and pass in a list of post_id’s:

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.

4 Likes