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

Error

表示一条错误消息。

    • 示例
    • 属性
      • error
      • error_description 可选
    • 可能的原因
      • 400 - 非法请求
      • 401 - 未授权
      • 403 - 禁止访问
      • 404 - 未找到
      • 422 - 无法处理的实体
      • 429 - 请求过于频繁
      • 503 - 服务不可用
    • 另请查看

示例

{
  "error": "invalid_grant",
  "error_description": "The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."
}
错误响应中最重要的是 HTTP 状态码。 遵循标准语义。 错误的 body 是一个 JSON 对象,包含更多信息(如果可用)。

属性

error

描述: 错误消息。
类型: 字符串
版本历史:
0.6.0 - 添加

error_description 可选

描述: 错误的更长描述,主要与 OAuth API 一起提供。
类型: 字符串
版本历史:
0.6.0 - 添加

可能的原因

400 - 非法请求

ParameterMissing

错误: {string}。 当 API 调用中缺少必需的参数时出现。

401 - 未授权

require_authenticated_user!

错误: 此 API 要求用户进行身份验证。 当实例处于安全模式时出现,该模式禁用 API 方法的所有公共使用。

403 - 禁止访问

NotPermitted

错误: 不允许此操作。 尝试调用你没有权限的方法(例如管理或工作人员方法),或执行不允许你执行的操作(例如关注阻止你的用户)时出现。

current_user.disabled?

错误: 你的账户当前已被禁用。 当 OAuth 令牌的授权用户已由管理员禁用其帐户时出现。

!current_user.confirmed?

错误: 你的账户缺少已确认的电子邮件地址。 当与 OAuth 令牌的授权用户的帐户关联的电子邮件地址尚未确认时出现。

!current_user.approved?

错误: 你的账户当前正在等待批准。 当 OAuth 令牌的授权用户在需要批准注册的实例上注册,并且用户尚未由管理员批准其帐户时出现。

404 - 未找到

RecordNotFound

错误: 未找到记录。 当实体记录不存在,或者授权用户不在私有实体的访问范围内时出现。

422 - 无法处理的实体

RecordInvalid

错误: {string}。 当实体创建失败时可能会出现。

RecordNotUnique

错误: 重复记录。 当你尝试置顶一个已置顶的帐户或嘟文时出现。

!current_user

错误: 此方法需要经过身份验证的用户。 尝试调用需要处理用户的 API 方法时,在使用没有授权用户的 OAuth 令牌(或根本没有令牌)时出现。

429 - 请求过于频繁

错误: {translated string}。 当你超过速率限制时出现。 有关更多信息,请参见 速率限制。

503 - 服务不可用

UnexpectedResponseError

错误: 无法获取外站数据。 当 Mastodon 调用返回错误的外站服务(例如来自另一个实例的 WebFinger)时出现。

SSLError

错误: 无法验证外站 SSL 证书。 调用外站服务时,但它具有无效的 SSL 证书时出现。

NetworkingError

错误: 为你的请求提供服务时出现临时问题,请重试。 当对 S3 存储实例的调用失败时出现。

RaceConditionError

错误: 为你的请求提供服务时出现临时问题,请重试。 由于实例端代码中存在争用情况导致错误时出现。

另请查看

app/controllers/api/base_controller.rb

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

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

赞助商

Dotcom-Monitor LoadView Stephen Tures Swayable SponsorMotion

加入Mastodon · 博客 ·

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