Is there a limit to number of posts shown in json feeds?

I’ve got a script reviewing topic feeds on our Discourse implementation, but I’ve found that it only returns the first 20 Posts (some of our topics have more than 20 posts)… is that a hardcoded limit? Is there any way to return the json feed in reverse order, with the newest first?

Our script runs every few minutes and would be more likely to see all the posts in a topic if they were provided by the feed with most recent first if there’s a 20 post limit to the topic feed… Is there any way to get a full list of posts in the topic? Example: https://forums.oeru.org/t/133.json has a post_count: 29 but only the first 20 (0-19) are shown from /1-/20…

I could use the post_count to look for further ones, but things get tricky because presumably there could be deleted post (missing ids) and it’d be very inefficient to try to them all in sequence, counting as I go, and discarding any missing IDs from my count…

Is there another mechanism that I’m missing? I have discounted the Post IDs shown in the post_stream, as the IDs (if I use /p/postID or /p/postID.json) get redirected to the HTML version of the post which isn’t overly helpful…

Have you tried going to the 2nd page? https://forums.oeru.org/t/133.json?page=2 :wink:

3 Likes

Nope - never saw any documentation that suggested the json results were paged :slight_smile: - thanks for clarifying!

This topic was automatically closed after 33 hours. New replies are no longer allowed.