# 如何获取Discourse的所有帖子（有可用的API吗？）

**URL:** https://meta.discourse.org/t/how-to-get-all-posts-from-discourse-any-api-available/186953
**Category:** Development
**Created:** [2021年四月15日 13:08 UTC](https://meta.discourse.org/t/how-to-get-all-posts-from-discourse-any-api-available/186953 "2021-04-15T13:08:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nareshh\_Raja](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nareshh_raja/32/209929_2.png) [@Nareshh\_Raja](https://meta.discourse.org/u/Nareshh_Raja)
#### Post date: [2021年四月15日 13:08 UTC](https://meta.discourse.org/t/how-to-get-all-posts-from-discourse-any-api-available/186953/1 "2021-04-15T13:08:57Z")

</div>

如何获取 Discourse 中的所有帖子。我们需要从 Discourse 抓取数据到我们的网站，以便在搜索结果中显示帖子链接。我们尝试了以下两个 API 调用，但只返回了最新的帖子：

/posts.json  
/posts.json?before=17907

请建议一种获取 Discourse 中所有帖子（包括其中的每个帖子和主题，而非特定内容）的方法。

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2021年四月15日 15:53 UTC](https://meta.discourse.org/t/how-to-get-all-posts-from-discourse-any-api-available/186953/2 "2021-04-15T15:53:09Z")

</div>

您可以多说一些您试图解决的问题。

数据探索插件可能是查找您所需内容的最佳工具。设置好查询后，您可以通过 API 提取 CSV 或 JSON 文件，只需一次查询即可完成。
