# 导出/提取社区健康数据

**URL:** https://meta.discourse.org/t/exporting-extracting-community-health-data/263988
**Category:** Data & reporting
**Created:** [2023年五月5日 16:23 UTC](https://meta.discourse.org/t/exporting-extracting-community-health-data/263988 "2023-05-05T16:23:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![oneonetwothree](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oneonetwothree](https://meta.discourse.org/u/oneonetwothree)
#### Post date: [2023年五月5日 16:23 UTC](https://meta.discourse.org/t/exporting-extracting-community-health-data/263988/1 "2023-05-05T16:23:16Z")

</div>

是否可以以编程方式（API 等）轻松访问预先计算的社区健康数据？我希望能够利用这些数据，而无需推导计算每项数据的方法，并冒着与社区健康页面结果不一致的风险。谢谢！

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年五月5日 17:04 UTC](https://meta.discourse.org/t/exporting-extracting-community-health-data/263988/2 "2023-05-05T17:04:15Z")

</div>

你好 @oneonetwothree 🙂

你可以将报告数据输出为 JSON 格式。

例如，从 1 月 1 日到 5 月 1 日的帖子数据：

`https://your-discourse.com/admin/reports/posts.json?end_date=2023-05-01&mode=table&start_date=2023-01-01`

将输出此内容：

```json
{
  "report": {
    "type": "posts",
    "title": "Posts",
    "xaxis": "Day",
    "yaxis": "Number of new posts",
    "description": "New posts created during this period",
    "description_link": null,
    "data": [
      {
        "x": "2023-01-22",
        "y": 1
      },
      {
        "x": "2023-01-27",
        "y": 1
      },
      {
        "x": "2023-01-31",
        "y": 1
      },
      {
        "x": "2023-02-01",
        "y": 1
      },
      {
        "x": "2023-02-02",
        "y": 1
      },
      {
        "x": "2023-02-06",
        "y": 22
      },
      {
        "x": "2023-02-07",
        "y": 2
      },
      {
        "x": "2023-02-10",
        "y": 3
      },
      {
        "x": "2023-02-11",
        "y": 5
      },
      {
        "x": "2023-02-13",
        "y": 1
      },
      {
        "x": "2023-02-14",
        "y": 1
      },
      {
        "x": "2023-02-17",
        "y": 5
      },
      {
        "x": "2023-02-20",
        "y": 6
      },
      {
        "x": "2023-02-21",
        "y": 1
      },
      {
        "x": "2023-02-22",
        "y": 1
      },
      {
        "x": "2023-02-23",
        "y": 1
      },
      {
        "x": "2023-02-24",
        "y": 2
      },
      {
        "x": "2023-02-25",
        "y": 1
      },
      {
        "x": "2023-03-01",
        "y": 1
      },
      {
        "x": "2023-03-02",
        "y": 4
      },
      {
        "x": "2023-03-03",
        "y": 1
      },
      {
        "x": "2023-03-05",
        "y": 2
      },
      {
        "x": "2023-03-06",
        "y": 1
      },
      {
        "x": "2023-03-08",
        "y": 1
      },
      {
        "x": "2023-03-09",
        "y": 2
      },
      {
        "x": "2023-03-13",
        "y": 1
      },
      {
        "x": "2023-03-16",
        "y": 1
      },
      {
        "x": "2023-03-17",
        "y": 9
      },
      {
        "x": "2023-03-20",
        "y": 1
      },
      {
        "x": "2023-03-22",
        "y": 1
      },
      {
        "x": "2023-03-23",
        "y": 2
      },
      {
        "x": "2023-03-25",
        "y": 1
      },
      {
        "x": "2023-03-31",
        "y": 1
      },
      {
        "x": "2023-04-01",
        "y": 1
      },
      {
        "x": "2023-04-03",
        "y": 1
      },
      {
        "x": "2023-04-04",
        "y": 9
      },
      {
        "x": "2023-04-07",
        "y": 1
      },
      {
        "x": "2023-04-08",
        "y": 1
      },
      {
        "x": "2023-04-12",
        "y": 3
      },
      {
        "x": "2023-04-13",
        "y": 4
      },
      {
        "x": "2023-04-14",
        "y": 6
      },
      {
        "x": "2023-04-19",
        "y": 1
      },
      {
        "x": "2023-04-23",
        "y": 1
      },
      {
        "x": "2023-04-24",
        "y": 2
      },
      {
        "x": "2023-04-25",
        "y": 6
      }
    ],
    "start_date": "2023-01-01T00:00:00Z",
    "end_date": "2023-05-01T23:59:59Z",
    "prev_data": null,
    "prev_start_date": "2022-09-02T00:00:00Z",
    "prev_end_date": "2023-01-01T00:00:00Z",
    "prev30Days": 10,
    "dates_filtering": true,
    "report_key": "reports:posts:20230101:20230501:[:total, :prev30Days]:4",
    "primary_color": "rgba(0,136,204,1)",
    "secondary_color": "rgba(0,136,204,0.1)",
    "available_filters": [
      {
        "id": "category",
        "type": "category",
        "default": null
      }
    ],
    "labels": [
      {
        "type": "date",
        "property": "x",
        "title": "Day"
      },
      {
        "type": "number",
        "property": "y",
        "title": "Count"
      }
    ],
    "average": false,
    "percent": false,
    "higher_is_better": true,
    "modes": [
      "table",
      "chart"
    ],
    "total": 167
  }
}

```

这就是您要找的吗？

---

<div class="post-metadata">

### Author: ![oneonetwothree](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oneonetwothree](https://meta.discourse.org/u/oneonetwothree)
#### Post date: [2023年五月5日 17:45 UTC](https://meta.discourse.org/t/exporting-extracting-community-health-data/263988/3 "2023-05-05T17:45:02Z")

</div>

太好了！那些端点有文档吗？我在 [https://docs.discourse.org/](https://docs.discourse.org/) 上没找到。

我设法猜到了注册、主题和帖子的端点；但我也希望能获取 DAU/MAU、每日活跃用户、新贡献者和汇总页面浏览量。您知道这些是否存在吗？谢谢！

---

<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: [2023年五月8日 23:31 UTC](https://meta.discourse.org/t/exporting-extracting-community-health-data/263988/4 "2023-05-08T23:31:19Z")

</div>

通常，您可以在任何网址末尾添加`.json`来获取Rails发送的内容。

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

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2023年六月7日 23:31 UTC](https://meta.discourse.org/t/exporting-extracting-community-health-data/263988/5 "2023-06-07T23:31:50Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
