大家好,
我正在寻找设置一个在 Discourse 中更新帖子的机器人的最佳方法(或一份文档详尽的入门指南)。我们计划使用树莓派来检查一些开关的状态,并根据这些状态更新论坛中的帖子。
欢迎提供任何建议。提前感谢。
Richarde
Pravi
(PK)
2021 年6 月 26 日 18:44
2
要远程更新帖子,您必须配置邮件接收器,或者可以依赖 Discourse API。
1 个赞
谢谢 @Pravi
有没有适合新手的入门指南?
提前感谢
编辑:在思考 API 能带来的各种可能性后,我更倾向于采用该方案。
现在就开始着手查找相关设置信息……欢迎提供任何提示。
fzngagan
(Faizaan Gagan)
2021 年6 月 27 日 12:33
4
您可以使用此 gem 连接到 Discourse 并执行您需要的任何操作。
So you want to use Discourse API ? Great! Let’s get started.
Set up Discourse development environment
Set up Discourse development environment using our Windows , macOS or Ubuntu guide.
Clone Discourse API Gem
Now that you have set up Discourse development environment, you should already have Git and Ruby installed on your system. You can install Discourse API gem by running following command from console:
git clone https://github.com/discourse/discourse_api.git ~/discourse_api
Alternatively…
4 个赞
Pravi
(PK)
2021 年6 月 27 日 12:35
5
我从未使用过 Discourse API,因此无法在 API 方面为您提供帮助。但我希望以下链接能帮助您入门。
https://meta.discourse.org/search?q=discourse%20api
Discourse API
Please view the Discourse API Documentation site for detailed info:
https://docs.discourse.org
Authentication
API requests must use HTTP header based authentication. Pass your Api-Key and Api-Username as HTTP headers. Authentication via query parameters or request body is not supported (this was removed in April 2020). Please see the example cURL request below.
The only API endpoints that continue to support credentials in query parameters are requests to…
https://meta.discourse.org/t/how-to-run-data-explorer-queries-with-the-discourse-api/120063/2
Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api.
The API is documented at docs.discourse.org . You can also use the discourse_api Ruby gem as a client library. However, not every endpoint is documented.
To determine how to do something with the JSON API here are some steps you can follow.
Example: recategorize a topic.
Go to a topic and start editing a category:
[image]
Open Chrome dev tools, switch to the Network tab, select …
3 个赞
我正在路上:
目前为止我所做的:
生成了一个 API 密钥
在 Postman 中编写了几个 Put 和 Get 请求,运行完美
将集合导出为 JSON 文件
我知道有一个用于该 API 的 Ruby 框架,但我更倾向于使用 Python,因为我已经在那里写过一些脚本了。
有人知道接下来该怎么做吗?
此致,
Richarde
1 个赞
好的,我刚刚发现了 pydiscourse,看起来效果相当不错
所以在 Postman 中设置一切步骤其实并非必要,但它有助于理解 API 的逻辑——所以也不算完全浪费时间
简而言之,如果你想通过 Python 与 Discourse 进行交互,可以使用 pydiscourse ,它基于以下作者的原始工作(列表可能不完整):
Marc Sibson
James Potter
Ben Lopatin
Daniel Zohar
Matheus Fernandes
Scott Nixon
Jason Dorweiler
Pierre-Alain Dupont
Karl Goetz
Alex Kerney
Gustav https://github.com/dkgv
2 个赞
system
(system)
关闭
2021 年7 月 27 日 17:30
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.