In a discussion titled “Get number of likes for a single post?” under the Dev category and tagged with rest-api, mr8 initially sought a way to retrieve the like count for an individual post via the Discourse API, noting that like_count only appeared for entire topics. After some exploration, mr8 discovered the like count is available under the actions_summary field in the API response — for example, {"id":2, "count":5,"acted":true} — though this field is omitted if a post has no likes. smileBeda pointed out this behavior makes the API unreliable and noted the absence of documentation for this feature in official API docs. blake acknowledged the gap and committed to improving the API documentation, explaining it’s partially auto-generated via rspec tests using rswag. smileBeda offered to help with documentation, asking whether it’s manually written or code-generated; blake clarified it’s a hybrid approach, and shared a link to a meta topic explaining how to contribute to the API docs.
Hello,
I’m trying to get the number of likes for a single post via the API, but can’t seem to find it…
I see a like_count for the entire topic, but can’t seem to find the individual like count for each post in either /t/123.json or /posts/222.json.
I noticed that I can get a list of users who liked a post via /post_action_users.json and add them up manually, but what is the recommended way to to get the “like count” for an individual post?
정말 그 점에 대해 감사드립니다.
제가 이 부분에 도움이 될 수 있다면 (사람이 작성한 건가요?!) 알려주세요.
하지만 Discourse가 작성된 언어가 Ruby든 PHPdoc 같은 것을 사용하든, 아마도 그런 걸 쓰고 계신 것 같습니다.
저는 그 언어에 대해 경험이 없어서, 프로그래밍적인 부분이라면 아직 도움을 드리기 어렵습니다