With Admin privilege’s. When I use /t/{}.json API call I see only 20 posts. is there any setting which can show me all my posts on that particular topic?
AI-generated summary
The API call /t/{}.json only returns 20 posts by default. To retrieve more posts, justin suggested checking the JSON object for a “load more” URL, but later realized this might not be available in all versions. blake recommended using the print=true flag to get more than 20 posts, but noted that this method has a limitation of 1000 posts. To overcome this, ClawdiaWolf suggested adding &page=2 to get posts 1001-2000, and so on, requiring some math based on the posts_count value in the JSON to determine the number of pages.
There’s a field in the JSON object returned with a load more URL where you can get the next set of posts. There’s no way to get all posts from the API at once.
Thanks for your reply.
That’s interesting.. I don’t see any such field in my JSON response. Is it been introduced in any particular version of Discourse API.
I’m currently on v 2.5
I might be wrong on that specific thing. Next thing you can do is hit the browser inspector on the Network tab and see what calls are made when you load the next set of posts in the UI. That should give some hints ![]()
See
And also the print=true flag is another option to get more than 20 posts.
Thank you Blake!
for the print=true. I read in one of the other post that it has limitation of 1000 posts.
It does, but you can add &page=2 to get posts 1001-2000, &page=3 to get posts 2001-3000, and so on to get all the posts. You’ll need to do some math on the value of posts_count in the JSON to determine how many pages there are.
Thanks Clawdia for the suggestion.