# 如何获取每个主题类别中原始数据的 JSON？

**URL:** <https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340>\
**Category:** Development\
**Created:** [2020年四月17日 12:02 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340 "2020-04-17T12:02:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![eextra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eextra/32/170266_2.png) [@eextra](https://meta.discourse.org/u/eextra)\
**Post date:** [2020年四月17日 12:02 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/1 "2020-04-17T12:02:12Z")

</div>

例如，[https://meta.discourse.org/c/dev/7.json](https://meta.discourse.org/c/dev/7.json) 会向我显示开发类别的主题列表。

我能否以类似方式显示该类别中每个主题的内容（原始文本）？

---

<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:** [2020年四月17日 12:59 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/2 "2020-04-17T12:59:29Z")

</div>

查看 [如何逆向工程 Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576)

---

<div class="post-metadata">

**Author:** ![eextra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eextra/32/170266_2.png) [@eextra](https://meta.discourse.org/u/eextra)\
**Post date:** [2020年四月17日 18:37 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/3 "2020-04-17T18:37:54Z")

</div>

非常感谢。这确实帮了忙。

我不确定这样做是否正确和最优，但我尝试了类似的方法：`https://meta.discourse.org/search.json?q=category%3Abug`。

我该如何显示帖子的全部内容，而不是仅显示前约 300 个字符？

---

<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:** [2020年四月17日 18:57 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/4 "2020-04-17T18:57:06Z")

</div>

```
https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340.json

```

---

<div class="post-metadata">

**Author:** ![eextra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eextra/32/170266_2.png) [@eextra](https://meta.discourse.org/u/eextra)\
**Post date:** [2020年四月17日 19:05 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/5 "2020-04-17T19:05:46Z")

</div>

但这只是一篇帖子的内容，而我想获取一系列帖子的集合。

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2020年四月17日 19:11 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/6 "2020-04-17T19:11:30Z")

</div>

如果您需要包含所有帖子的多个主题，您需要发起多次调用。

此外，还有 `posts.json` 端点，即 `https://meta.discourse.org/posts.json?category=support`。

---

<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:** [2020年四月17日 19:17 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/7 "2020-04-17T19:17:43Z")

</div>

这可能会有所帮助：[https://github.com/pfaffman/discourse-downloader（或者它可能完全无法工作——例如，它可能没有正确地将](https://github.com/pfaffman/discourse-downloader%EF%BC%88%E6%88%96%E8%80%85%E5%AE%83%E5%8F%AF%E8%83%BD%E5%AE%8C%E5%85%A8%E6%97%A0%E6%B3%95%E5%B7%A5%E4%BD%9C%E2%80%94%E2%80%94%E4%BE%8B%E5%A6%82%EF%BC%8C%E5%AE%83%E5%8F%AF%E8%83%BD%E6%B2%A1%E6%9C%89%E6%AD%A3%E7%A1%AE%E5%9C%B0%E5%B0%86) API 密钥放在请求头中，而是放在了 URL 中）

---

<div class="post-metadata">

**Author:** ![eextra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eextra/32/170266_2.png) [@eextra](https://meta.discourse.org/u/eextra)\
**Post date:** [2020年四月17日 19:46 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/8 "2020-04-17T19:46:49Z")

</div>

> [@Falco](#):
>
> `https://meta.discourse.org/posts.json?category=support` .

非常感谢——你总是直奔主题！  
是否可以将所有内容显示在一页上？（目前仅显示 **45** 个主题）

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2020年四月17日 19:52 UTC](https://meta.discourse.org/t/how-do-i-get-the-json-for-the-each-raw-from-topics-in-the-category/148340/9 "2020-04-17T19:52:21Z")

</div>

你需要进行分页。

对于第二次调用，添加一个名为 `before` 的参数，其值为上一次调用中获取的最后一个帖子 ID。

示例：`https://meta.discourse.org/posts.json?category=support&before=735490`
