如何通过 API 按主题获取评论和/或点赞数量?

通过 API 获取主题收到的评论数量(以及点赞数,可以是首帖的点赞数或所有帖子的总点赞数)的最有效方法是什么?

(我还没有查看,但我想应该有一个计数器缓存来存储回复数量等?是否可以通过 API 获取这些数据,而不是加载整个主题等?)

If you fetch a topic via the api like:

http://localhost:3000/t/welcome-to-discourse/8.json

It will return lots of things, but 2 of the values are:

posts_count:	214
like_count:	2

posts_count is the total number of posts the topic has. like_count is the total number of likes across all posts on the topic.

8 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.