mr8
2017 年8 月 29 日 22:50
1
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?
Thanks!
2 个赞
mr8
2017 年8 月 29 日 22:56
2
I’m an idiot!
Found it under "actions_summary":
{"id":2,"count":5,"acted":true}
Well, hope this helps someone else!
16 个赞
mr8:
actions_summary
Love you man! that helps me a lot!
遗憾的是,如果帖子没有点赞,Discourse 会移除该属性。
此外,它也不在 API 文档中:Discourse API Docs , Discourse API Docs
因此,不可靠,代码会被不必要的“if property object exist”污染。
应该改进,最好是这样。
1 个赞
blake
(Blake Erickson)
2023 年3 月 14 日 14:26
6
Beda:
它也没有在 API 文档中
感谢您的反馈。是的,查看 API 文档,上面没有任何关于获取点赞的信息,只有关于创建点赞的信息。我将首先改进这方面的 API 文档。
1 个赞
非常感谢你。\n如果我能在这方面提供帮助(这是人工写的吗?!),请告诉我。\n但我怀疑你使用的是类似 PHPdoc 的东西,只是用于 Ruby,或者 Discourse 所用的任何语言?\n我没有那种语言的经验,所以如果是程序化的,我帮不了(目前还不行):P
1 个赞
blake
(Blake Erickson)
2023 年3 月 20 日 14:27
11
Beda:
这是人工写的吗?!
我认为是各占一半。仍然需要人工操作,但它们是通过一个名为 rswag 的工具从 rspec 测试生成的。
This is a guide for contributing to the official Discourse API documentation.
Required user level: Developer
Console access required
Do you want to contribute to the official API documentation at https://docs.discourse.org ? This guide will explain step by step how to do it.
Summary
This documentation will guide you through the following steps:
Setting up prerequisites.
Cloning the Discourse API documentation repository.
Editing the API documentati…
1 个赞
system
(system)
关闭
2023 年4 月 19 日 14:28
12
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.