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

timelines API方法

读取和查看嘟文的时间线。

    • 查看公共时间线
    • 查看话题标签时间线
    • 查看主页时间线
    • 查看链接时间线
    • 查看列表时间线
    • 查看私信时间线 已弃用
    • 另请参考

查看公共时间线

GET /api/v1/timelines/public HTTP/1.1

查看公开嘟文。

返回: Status 数组
OAuth: 允许公开调用。 若实例已禁用公共预览,则需要应用令牌 + read:statuses。
版本历史:
0.0.0 - 添加
2.3.0 - 添加 only_media
2.6.0 - 添加 min_id
3.0.0 - 若公共预览已禁用,则需要身份验证
3.1.4 - 添加 remote
3.3.0 - 现在可以同时使用 min_id 和 max_id

请求

标头
Authorization
提供此标头以及 Bearer <user_token>,以获得对此 API 方法的访问授权。
查询参数
local
布尔值。 是否仅显示本站嘟文? 默认为 false。
remote
布尔值。 是否仅显示外站嘟文? 默认为 false。
only_media
布尔值。 是否仅显示附有媒体的嘟文? 默认为 false。
max_id
字符串。 返回的所有结果将小于此 ID。 事实上设置了结果的上限。
since_id
字符串。 返回的所有结果将大于此 ID。 事实上设置了结果的下限。
min_id
字符串。 返回与此 ID 相邻且更新的结果。 事实上在此 ID 处设置游标并向前分页。
limit
整数。 要返回的最大结果数。 默认为 20 个嘟文。 最多 40 个嘟文。

响应

200: OK

带有 limit=2 的示例 API 调用

[
  {
    "id": "103206804533200177",
    "created_at": "2019-11-26T23:27:31.000Z",
    // ...
    "visibility": "public",
    // ...
  },
  {
    "id": "103206804086086361",
    "created_at": "2019-11-26T23:27:32.000Z",
    // ...
    "visibility": "public",
    // ...
  }
]

查看话题标签时间线

GET /api/v1/timelines/tag/:hashtag HTTP/1.1

查看包含给定话题标签的公开嘟文。

返回: Status 数组
OAuth: 允许公开调用。 若实例已禁用公共预览,则需要应用令牌 + read:statuses。
版本历史:
0.0.0 - 添加
2.3.0 - 添加 only_media
2.6.0 - 添加 min_id
2.7.0 - 为其他标签添加 any[]、all[]、none[]
3.0.0 - 若公共预览已禁用,则需要身份验证
3.3.0 - 现在可以同时使用 min_id 和 max_id。 添加 remote

请求

路径参数
:hashtag
必需 字符串。 话题标签的名称(不包括#符号)。
标头
Authorization
提供此标头以及 Bearer <user_token>,以获得对此 API 方法的访问授权。
查询参数
any[]
字符串数组。 返回包含其中任何一个话题标签的嘟文。
all[]
字符串数组。 返回同时包含所有话题标签的嘟文。
none[]
字符串数组。 返回不包含其中任何一个话题标签的嘟文。
local
布尔值。 是否仅返回本站嘟文? 默认为 false。
remote
布尔值。 是否仅返回外站嘟文? 默认为 false。
only_media
布尔值。 是否仅返回附有媒体的嘟文? 默认为 false。
max_id
字符串。 返回的所有结果将小于此 ID。 事实上设置了结果的上限。
since_id
字符串。 返回的所有结果将大于此 ID。 事实上设置了结果的下限。
min_id
字符串。 返回与此 ID 相邻且更新的结果。 事实上在此 ID 处设置游标并向前分页。
limit
整数。 要返回的最大结果数。 默认为 20 个嘟文。 最多 40 个嘟文。

响应

200: OK

话题标签 #cats 的时间线示例,limit=2

[
  {
    "id": "103206185588894565",
    "created_at": "2019-11-26T20:50:15.866Z",
    // ...
    "visibility": "public",
    // ...
    "content": "<p><a href=\"https://mastodon.social/tags/cats\" class=\"mention hashtag\" rel=\"tag\">#<span>cats</span></a></p>",
    // ...
    "tags": [
      {
        "name": "cats",
        "url": "https://mastodon.social/tags/cats"
      }
    ],
    // ...
  },
  {
    "id": "103203659567597966",
    "created_at": "2019-11-26T10:07:49.000Z",
    // ...
    "visibility": "public",
    // ...
    "content": "<p>Caught on the hop. 😺 </p><p><a href=\"https://chaos.social/tags/Qualit%C3%A4tskatzen\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>Qualitätskatzen</span></a> <a href=\"https://chaos.social/tags/cats\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>cats</span></a> <a href=\"https://chaos.social/tags/mastocats\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>mastocats</span></a> <a href=\"https://chaos.social/tags/catsofmastodon\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>catsofmastodon</span></a> <a href=\"https://chaos.social/tags/Greece\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>Greece</span></a> <a href=\"https://chaos.social/tags/Agistri\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>Agistri</span></a><br>(photo: <span class=\"h-card\"><a href=\"https://chaos.social/@kernpanik\" class=\"u-url mention\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">@<span>kernpanik</span></a></span> | license: CC BY-NC-SA 4.0)</p>",
    // ...
    "tags": [
      {
        "name": "qualitätskatzen",
        "url": "https://mastodon.social/tags/qualit%C3%A4tskatzen"
      },
      {
        "name": "cats",
        "url": "https://mastodon.social/tags/cats"
      },
      {
        "name": "mastocats",
        "url": "https://mastodon.social/tags/mastocats"
      },
      {
        "name": "catsofmastodon",
        "url": "https://mastodon.social/tags/catsofmastodon"
      },
      {
        "name": "greece",
        "url": "https://mastodon.social/tags/greece"
      },
      {
        "name": "agistri",
        "url": "https://mastodon.social/tags/agistri"
      }
    ],
    // ...
  }
]
404: Not found

话题标签不存在

{
  "error": "Record not found"
}

查看主页时间线

GET /api/v1/timelines/home HTTP/1.1

查看来自关注的用户和话题标签的嘟文。

返回: Status 数组
OAuth: 用户 + read:statuses
版本历史:
0.0.0 - 添加
2.6.0 - 添加 min_id
3.3.0 - 现在可以同时使用 min_id 和 max_id 4.0.0 - 由于用户现在可以关注话题标签,因此来自未关注用户的嘟文可能会出现在时间线中

请求

标头
Authorization
必需 提供此标头以及 Bearer <user_token>,以获得对此 API 方法的访问授权。
查询参数
max_id
字符串。 返回的所有结果将小于此 ID。 事实上设置了结果的上限。
since_id
字符串。 返回的所有结果将大于此 ID。 事实上设置了结果的下限。
min_id
字符串。 返回与此 ID 相邻且更新的结果。 事实上在此 ID 处设置游标并向前分页。
limit
整数。 要返回的最大结果数。 默认为 20 个嘟文。 最多 40 个嘟文。

响应

200: OK

将返回主页时间线中的嘟文

[
  {
    "id": "103206791453397862",
    "created_at": "2019-11-26T23:24:13.113Z",
    // ...
  },
  // ...
]
206: Partial content

正在重新生成主页信息流

401: Unauthorized

Authorization 标头无效或缺失。

{
  "error": "The access token is invalid"
}

查看链接时间线

GET /api/v1/timelines/link?url=:url HTTP/1.1

查看包含指向指定的当前热门文章的链接的公开嘟文。 这仅列出来自选择加入发现功能的用户的嘟文。

返回: Status 数组
OAuth: 允许公开调用。 若实例已禁用公共预览,则需要应用令牌 + read:statuses。
版本历史:
4.3.0 - 添加

请求

标头
Authorization
提供此标头以及 Bearer <user token>,以获得对此 API 方法的访问授权。
查询参数
url
必需 字符串。热门文章的 URL。
max_id
字符串。 返回的所有结果将小于此 ID。 事实上设置了结果的上限。
since_id
字符串。 返回的所有结果将大于此 ID。 事实上设置了结果的下限。
min_id
字符串。 返回与此 ID 相邻且更新的结果。 事实上在此 ID 处设置游标并向前分页。
limit
整数。 要返回的最大结果数。 默认为 20 个嘟文。 最多 40 个嘟文。

响应

200: OK
404: Not found

提供的 URL 当前不是热门文章链接。

{
  "error": "Record not found"
}

查看列表时间线

GET /api/v1/timelines/list/:list_id HTTP/1.1

查看给定列表时间线中的嘟文。

返回: Status 数组
OAuth: 用户令牌 + read:lists
版本历史:
2.1.0 - 添加
2.6.0 - 添加 min_id
3.3.0 - 现在可以同时使用 min_id 和 max_id

请求

路径参数
:list_id
必需 字符串。 数据库中列表的本站 ID。
标头
Authorization
必需 提供此标头以及 Bearer <user_token>,以获得对此 API 方法的访问授权。
查询参数
max_id
字符串。 返回的所有结果将小于此 ID。 事实上设置了结果的上限。
since_id
字符串。 返回的所有结果将大于此 ID。 事实上设置了结果的下限。
min_id
字符串。 返回与此 ID 相邻且更新的结果。 事实上在此 ID 处设置游标并向前分页。
limit
整数。 要返回的最大结果数。 默认为 20 个嘟文。 最多 40 个嘟文。

响应

200: OK

将返回此列表中的嘟文。

[
  {
    "id": "103206791453397862",
    "created_at": "2019-11-26T23:24:13.113Z",
    // ...
  },
  // ...
]
401: Unauthorized

Authorization 标头无效或缺失。

{
  "error": "The access token is invalid"
}
404: Not found

你并未拥有该列表或该列表不存在

{
  "error": "Record not found"
}

查看私信时间线 已弃用

GET /api/v1/timelines/direct HTTP/1.1

查看你的帐户或通知中可见性设置为 “direct” 的嘟文。

返回: Status 数组
OAuth: 用户令牌 + read:statuses
版本历史:
x.x.x - 添加
2.6.0 - 添加 min_id。 已弃用,推荐使用 Conversations API
3.0.0 - 移除

请求

标头
Authorization
必需 提供此标头以及 Bearer <user_token>,以获得对此 API 方法的访问授权。
查询参数
max_id
字符串。 返回的所有结果将小于此 ID。 事实上设置了结果的上限。
since_id
字符串。 返回的所有结果将大于此 ID。 事实上设置了结果的下限。
min_id
字符串。 返回与此 ID 相邻且更新的结果。 事实上在此 ID 处设置游标并向前分页。
limit
整数。 要返回的最大结果数。 默认为 20 个嘟文。 最多 40 个嘟文。

响应

200: OK

由你撰写或提及了你的带有 direct 可见性的嘟文。 嘟文不按对话分组,而是按时间顺序返回。

[
  {
    "id": "103206185588894565",
    "created_at": "2019-11-26T20:50:15.866Z",
    // ...
    "visibility": "direct",
    // ...
  },
  // ...
]
401: Unauthorized

Authorization 标头无效或缺失。

{
  "error": "The access token is invalid"
}

另请参考

app/controllers/api/v1/timelines/home_controller.rb
app/controllers/api/v1/timelines/list_controller.rb
app/controllers/api/v1/timelines/public_controller.rb
app/controllers/api/v1/timelines/tag_controller.rb

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

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

赞助商

Dotcom-Monitor LoadView Stephen Tures Swayable SponsorMotion

加入Mastodon · 博客 ·

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