コミュニティの健康データをエクスポート/抽出する

事前に計算されたコミュニティヘルスデータをプログラムで簡単に(APIなど)アクセスすることは可能ですか?コミュニティヘルスページの結果と矛盾するリスクを冒して、各計算方法を推測せずにデータを利用できると嬉しいです。よろしくお願いします!

こんにちは @oneonetwothree :slight_smile:

レポートデータを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

これは次のように出力されます。

{
  "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
  }
}

お探しのものはこれでしょうか?

「いいね!」 3

素晴らしいですね!それらのエンドポイントのドキュメントはありますか? https://docs.discourse.org/ では見つけられませんでした。

サインアップ、トピック、投稿のエンドポイントは推測できましたが、DAU/MAU、デイリーエンゲージドユーザー、新規コントリビューター、統合ページビューも取得したいと考えています。それらも存在するかどうかご存知ですか?よろしくお願いします!

「いいね!」 1

ほとんどの場合、URLの末尾に.jsonを追加すると、Railsが送信しているものを取得できます。

Discourse APIのリバースエンジニアリング

「いいね!」 2

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