Mastodon
  • 什么是 Mastodon?
  • 使用 Mastodon
    • 注册帐户
    • 设置你的个人资料
    • 在你的账户发布内容
    • 使用网络功能
    • 处理不想看到的内容
    • 推广你和他人
    • 进行偏好设置
    • 更多设置
    • 在站点外使用 Mastodon
    • 迁移或离开账户
    • 运行你自己的站点
  • 运营 Mastodon
    • 准备你的服务器
    • 从源代码安装
    • 配置你的环境
    • 安装可选功能
      • 对象存储
      • 洋葱服务
      • 验证码
      • 单点登录
    • 配置全文搜索
    • 设置你的新实例
    • 使用管理 CLI
    • 升级到新版本
    • 备份你的服务器
    • 迁移到新机器
    • 扩大你的站点规模
    • 审核操作
    • 故障排除
      • 数据库索引损坏
    • 用户组
  • 开发 Mastodon 应用
    • API 入门指南
    • 使用公开数据
    • 获取客户端应用访问权限
    • 使用帐户登录
    • 库与实现
  • 向 Mastodon 项目做贡献
    • 技术概览
    • 设置开发环境
    • 代码结构
    • 路由
    • 漏洞赏金与责任披露
  • 遵循的标准
    • ActivityPub
    • WebFinger
    • 安全性
    • Microformats
    • OAuth
    • Bearcaps
  • REST API
    • Datetime 格式
    • 指南与最佳实践
    • OAuth 令牌
    • OAuth 作用域
    • 速率限制
  • API 方法
    • apps
      • oauth
      • emails
    • accounts
      • bookmarks
      • favourites
      • mutes
      • blocks
      • domain_blocks
      • filters
      • reports
      • follow_requests
      • endorsements
      • featured_tags
      • preferences
      • followed_tags
      • suggestions
      • tags
    • profile
    • statuses
      • media
      • polls
      • scheduled_statuses
    • timelines
      • conversations
      • lists
      • markers
      • streaming
    • grouped notifications
    • notifications
      • push
    • search
    • instance
      • trends
      • directory
      • custom_emojis
      • announcements
    • admin
      • accounts
      • canonical_email_blocks
      • dimensions
      • domain_allows
      • domain_blocks
      • email_domain_blocks
      • ip_blocks
      • measures
      • reports
      • retention
      • trends
    • proofs
    • oembed
  • API 实体
    • Account
    • AccountWarning
    • Admin::Account
    • Admin::CanonicalEmailBlock
    • Admin::Cohort
    • Admin::Dimension
    • Admin::DomainAllow
    • Admin::DomainBlock
    • Admin::EmailDomainBlock
    • Admin::Ip
    • Admin::IpBlock
    • Admin::Measure
    • Admin::Report
    • Announcement
    • Appeal
    • Application
    • Context
    • Conversation
    • CustomEmoji
    • DomainBlock
    • Error
    • ExtendedDescription
    • FamiliarFollowers
    • FeaturedTag
    • Filter
    • FilterKeyword
    • FilterResult
    • FilterStatus
    • IdentityProof
    • Instance
    • List
    • Marker
    • MediaAttachment
    • Notification
    • NotificationPolicy
    • NotificationRequest
    • Poll
    • Preferences
    • PreviewCard
    • PreviewCardAuthor
    • PrivacyPolicy
    • Reaction
    • Relationship
    • RelationshipSeveranceEvent
    • Report
    • Role
    • Rule
    • ScheduledStatus
    • Search
    • Status
    • StatusEdit
    • StatusSource
    • Suggestion
    • Tag
    • TermsOfService
    • Token
    • Translation
    • V1::Filter
    • V1::Instance
    • V1::NotificationPolicy
    • WebPushSubscription

measures API 方法

获取关于实例的统计指标。

    • 获取统计数据
    • 另请参考

获取统计数据

POST /api/v1/admin/measures HTTP/1.1

获取你的实例的统计数据。

返回: Admin::Measure数组
OAuth: 用户令牌 + admin:read
权限: 查看管理面板
版本历史:
3.5.0 - 添加
4.0.0 - 支持自定义用户组和权限

请求

标头
Authorization
必需 提供此标头,其中包含 Bearer <user_token> 以获得对此 API 方法的访问授权。
表单数据参数
keys[]
必需 字符串数组。通过对应的键字符串请求特定类别的统计数据。支持的类别包括:
  • active_users = 当前时间段内你实例上的活跃用户总数
  • new_users = 当前时间段内加入你实例的用户数
  • interactions = 当前时间段内本站嘟文的总互动数(喜欢、转发、回复)
  • opened_reports = 当前时间段内提交的举报总数
  • resolved_reports = 当前时间段内已解决的举报总数
  • tag_accounts = 当前时间段内在至少一条嘟文中使用过话题标签的总帐户数
  • tag_uses = 当前时间段内使用话题标签的嘟文总数
  • tag_servers = 当前时间段内使用话题标签的嘟文的外站实例总数
  • instance_accounts = 当前时间段内来自外站域名的帐户总数
  • instance_media_attachments = 当前时间段内来自外站域名的媒体附件使用的总空间
  • instance_reports = 当前时间段内针对来自外站域名的帐户提交的举报总数
  • instance_statuses = 当前时间段内来自外站域名的嘟文总数
  • instance_follows = 当前时间段内本站用户关注来自外站域名的帐户总数
  • instance_followers = 当前时间段内来自外站域名的帐户关注本站帐户总数
start_at
必需 (Datetime) 字符串。时间段的开始日期。若提供了时间,将被忽略。
end_at
必需 (Datetime) 字符串。时间段的结束日期。若提供了时间,将被忽略。
tag_accounts[id]
字符串。当 tag_accounts 是请求的键之一时,你必须提供一个话题标签 ID,以获取在给定时间段内有多少帐户在至少一条嘟文中使用了该话题标签的数据。
tag_uses[id]
字符串。当 tag_uses 是请求的键之一时,你必须提供一个话题标签 ID,以获取在给定时间段内有多少嘟文使用了该话题标签的数据。
tag_servers[id]
字符串。当 tag_servers 是请求的键之一时,你必须提供一个话题标签 ID,以获取在给定时间段内有多少实例在至少一条嘟文中使用了该话题标签的数据。
instance_accounts[domain]
字符串。当 instance_accounts 是请求的键之一时,你必须提供一个外站域名,以获取在给定时间段内从该实例发现了多少帐户的数据。
instance_media_attachments[domain]
字符串。当 instance_media_attachments 是请求的键之一时,你必须提供一个外站域名,以获取在给定时间段内该实例的媒体附件使用了多少空间的数据。
instance_reports[domain]
字符串。当 instance_reports 是请求的键之一时,你必须提供一个外站域名,以获取在给定时间段内针对该实例的帐户提交了多少举报的数据。
instance_statuses[domain]
字符串。当 instance_statuses 是请求的键之一时,你必须提供一个外站域名,以获取在给定时间段内有多少嘟文来自该实例的数据。
instance_follows[domain]
字符串。当 instance_follows 是请求的键之一时,你必须提供一个外站域名,以获取在给定时间段内本站帐户对来自该实例的帐户执行了多少关注的数据。
instance_followers[domain]
字符串。当 instance_followers 是请求的键之一时,你必须提供一个外站域名,以获取在给定时间段内来自该实例的帐户对本站帐户执行了多少关注的数据。

响应

200: OK

返回每个数据的数量数据,包括聚合数据以及按数据桶划分的数据。

[
  {
    "key": "active_users",
    "unit": null,
    "total": "2",
    "previous_total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00Z",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "new_users",
    "unit": null,
    "total": "2",
    "previous_total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "interactions",
    "unit": null,
    "total": "0",
    "previous_total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00Z",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "opened_reports",
    "unit": null,
    "total": "0",
    "previous_total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "resolved_reports",
    "unit": null,
    "total": "0",
    "previous_total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "tag_accounts",
    "unit": null,
    "total": "1",
    "previous_total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00Z",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "tag_uses",
    "unit": null,
    "total": "2",
    "previous_total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00Z",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "tag_servers",
    "unit": null,
    "total": "0",
    "previous_total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "instance_accounts",
    "unit": null,
    "total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "instance_media_attachments",
    "unit": "bytes",
    "total": "0",
    "human_value": "0 Bytes",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": ""
      },
      // ...
    ]
  },
  {
    "key": "instance_reports",
    "unit": null,
    "total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "instance_statuses",
    "unit": null,
    "total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "instance_follows",
    "unit": null,
    "total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  },
  {
    "key": "instance_followers",
    "unit": null,
    "total": "0",
    "data": [
      {
        "date": "2022-09-14T00:00:00.000+00:00",
        "value": "0"
      },
      // ...
    ]
  }
]
403: Forbidden

授权用户缺少权限,或者 Authorization 标头无效或缺失

{
  "error": "This action is not allowed"
}

另请参考

app/controllers/api/v1/admin/measures_controller.rb
app/lib/admin/metrics/measure.rb
app/lib/admin/metrics/measure/

翻译状态: 本文是英文页面 measures API methods 的翻译,最后翻译时间:2025-04-21,点击这里可以查看翻译后页面的改动。

最后更新于 April 21, 2025 · 改进此页面
也可在此找到: English

赞助商

Dotcom-Monitor LoadView Stephen Tures Swayable SponsorMotion

加入Mastodon · 博客 ·

查看源代码 · CC BY-SA 4.0 · 版权信息