Update zh-cn translations

This commit is contained in:
CDN 2025-04-06 03:29:30 +08:00
parent 5e2b739ee1
commit a939c23559
Signed by: CDN
GPG key ID: 0C656827F9F80080
168 changed files with 36955 additions and 1406 deletions

View file

@ -0,0 +1,12 @@
---
title: admin API 方法
description: 查看和管理管理信息。
menu:
docs:
weight: 80
name: admin
parent: methods
identifier: methods-admin
---
{{< translation-status-zh-cn raw_title="admin API methods" raw_link="/methods/admin/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,315 @@
---
title: canonical_email_blocks API 方法
description: 通过哈希值屏蔽某些电子邮件地址。
menu:
docs:
name: canonical_email_blocks
parent: methods-admin
identifier: methods-admin-canonical_email_blocks
aliases: [
"/methods/admin/canonical_email_blocks",
"/api/methods/admin/canonical_email_blocks",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 列出所有标准电子邮件屏蔽 {#get}
```http
GET /api/v1/admin/canonical_email_blocks HTTP/1.1
```
**返回:** [Admin::CanonicalEmailBlock]({{< relref "entities/Admin_CanonicalEmailBlock" >}}) 数组\
**OAuth** 用户令牌 + `admin:read:canonical_email_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 查询参数
max_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
since_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
min_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
limit
: 整数。要返回的最大结果数。默认为 100 个屏蔽。最多 200 个屏蔽。
#### 响应
##### 200: OK
```json
[
{
"id": "1",
"canonical_email_hash": "b344e55d11b3fc25d0d53194e0475838bf17e9be67ce3e6469956222d9a34f9c"
},
// ...
]
```
由于 CanonicalEmailBlock ID 通常不通过任何 API 响应公开,因此你必须解析 HTTP `Link` 标头以加载较旧或较新的结果。有关详细信息,请参阅[通过 API 响应分页]({{<relref "api/guidelines#pagination">}})。
```http
Link: <http://mastodon.example/api/v1/admin/canonical_email_blocks?limit=2&max_id=2>; rel="next", <http://mastodon.example/api/v1/admin/canonical_email_blocks?limit=2&since_id=1>; rel="prev"
```
##### 403: Forbidden
授权用户缺少权限,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 显示单个标准电子邮件屏蔽 {#get-one}
```http
GET /api/v1/admin/canonical_email_blocks/:id HTTP/1.1
```
**返回:** [Admin::CanonicalEmailBlock]({{< relref "entities/Admin_CanonicalEmailBlock" >}})\
**OAuth** 用户令牌 + `admin:read:canonical_email_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 Admin::CanonicalEmailBlock 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
```json
{
"id": "1",
"canonical_email_hash": "b344e55d11b3fc25d0d53194e0475838bf17e9be67ce3e6469956222d9a34f9c"
}
```
##### 403: Forbidden
授权用户缺少权限,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
标准电子邮件屏蔽不存在或已被删除
```json
{
"error": "Record not found"
}
```
---
## 测试 {#test}
```http
POST /api/v1/admin/canonical_email_blocks/test HTTP/1.1
```
标准并哈希电子邮件地址。
**返回:** [Admin::CanonicalEmailBlock]({{< relref "entities/Admin_CanonicalEmailBlock" >}}) 数组\
**OAuth** 用户令牌 + `admin:read:canonical_email_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 表单数据参数
email
: {{<required>}} 字符串。要进行规范化和哈希的电子邮件地址。
#### 响应
##### 200: OK
返回所有匹配的标准电子邮件屏蔽。
```json
[
{
"id": "1",
"canonical_email_hash": "b344e55d11b3fc25d0d53194e0475838bf17e9be67ce3e6469956222d9a34f9c"
}
]
```
##### 403: Forbidden
授权用户缺少权限,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 500: Server error
<!-- TODO: remove when https://github.com/mastodon/mastodon/issues/21774 is fixed -->
未提供电子邮件
---
## 屏蔽标准电子邮件 {#create}
```http
POST /api/v1/admin/canonical_email_blocks HTTP/1.1
```
**返回:** [Admin::CanonicalEmailBlock]({{< relref "entities/Admin_CanonicalEmailBlock" >}})\
**OAuth** 用户令牌 + `admin:write:canonical_email_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 表单数据参数
email
: {{<required>}} 字符串。要进行规范化、哈希和屏蔽的电子邮件地址。若提供了此参数,则将忽略 `canonical_email_hash`
canonical_email_hash
: 字符串。要测试的哈希值。若未提供 `email`,则需要此参数。
#### 响应
##### 200: OK
标准电子邮件已成功屏蔽
```json
{
"id": "1",
"canonical_email_hash": "b344e55d11b3fc25d0d53194e0475838bf17e9be67ce3e6469956222d9a34f9c"
}
```
##### 403: Forbidden
授权用户缺少权限,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 422: Unprocessable entity
标准电子邮件哈希已被屏蔽
```json
{
"error":"Validation failed: Canonical email hash has already been taken"
}
```
---
## 删除标准电子邮件屏蔽 {#delete}
```http
DELETE /api/v1/admin/canonical_email_blocks/:id HTTP/1.1
```
**返回:** [Admin::CanonicalEmailBlock]({{< relref "entities/Admin_CanonicalEmailBlock" >}})\
**OAuth** 用户令牌 + `admin:write:canonical_email_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 Admin::CanonicalEmailBlock 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
标准电子邮件屏蔽已成功删除。
```json
{}
```
##### 403: Forbidden
授权用户缺少权限,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
标准电子邮件屏蔽不存在或已被删除
```json
{
"error": "Record not found"
}
```
---
## 另请参阅
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/canonical_email_blocks_controller.rb" caption="app/controllers/api/v1/admin/canonical_email_blocks_controller.rb" >}}
{{< translation-status-zh-cn raw_title="canonical_email_blocks API methods" raw_link="/methods/admin/canonical_email_blocks/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,260 @@
---
title: dimensions API 方法
description: 获取有关实例的定性指标。
menu:
docs:
name: dimensions
parent: methods-admin
identifier: methods-admin-dimensions
aliases: [
"/methods/admin/dimensions",
"/api/methods/admin/dimensions",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 获取维度数据 {#get}
```http
POST /api/v1/admin/dimensions HTTP/1.1
```
获取有关某些帐户、实例、语言等受欢迎程度的信息。
**返回:** [Admin::Dimension]({{< relref "entities/Admin_Dimension" >}}) 数组\
**OAuth** 用户令牌 + `admin:read`\
**权限:** 查看管理面板\
**版本历史:**\
3.5.0 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 表单数据参数
keys[]
: {{<required>}} 字符串数组。按对应的键字符串请求特定维度。支持的维度包括:
- `languages` = 此实例上最常用的语言
- `sources` = 此实例上最常用的客户端应用
- `servers` = 嘟文最多的外站实例
- `space_usage` = 你的软件堆栈使用了多少空间
- `software_versions` = 你的软件堆栈的版本号
- `tag_servers` = 包含热门话题标签的嘟文的最常见实例
- `tag_languages` = 包含热门话题标签的嘟文的最常用语言
- `instance_accounts` = 来自外站实例的最受关注的帐户
- `instance_languages` = 来自外站实例的最常用的语言
start_at
: ([Datetime](/api/datetime-format#datetime)) 字符串。时间段的开始日期。若提供了时间,它将被忽略。
end_at
: ([Datetime](/api/datetime-format#datetime)) 字符串。时间段的结束日期。若提供了时间,它将被忽略。
limit
: 整数。要为来源、实例、语言、标签或实例维度返回的最大结果数。
tag_servers[id]
: 字符串。当 `tag_servers` 是请求的键之一时,你必须提供一个热门话题标签 ID 才能获得有关哪些实例正在发布该标签的信息。
tag_languages[id]
: 字符串。当 `tag_languages` 是请求的键之一时,你必须提供一个热门话题标签 ID 才能获得有关哪些语言正在发布该标签的信息。
instance_accounts[domain]
: 字符串。当 `instance_accounts` 是请求的键之一时,你必须提供一个域名才能获得有关来自该实例的受欢迎帐户的信息。
instance_languages[domain]
: 字符串。当 `instance_accounts` 是请求的键之一时,你必须提供一个域名才能获得有关来自该实例的受欢迎语言的信息。
#### 响应
##### 200: OK
请求 mastodon.social 上的数据以及给定热门话题标签,条目限制为 2。
```json
[
{
"key": "languages",
"data": [
{
"key": "en",
"human_key": "English",
"value": "10"
},
{
"key": "es",
"human_key": "Spanish",
"value": "1"
}
]
},
{
"key": "sources",
"data": [
{
"key": "web",
"human_key": "Website",
"value": "3"
}
]
},
{
"key": "servers",
"data": [
{
"key": "botsin.space",
"human_key": "botsin.space",
"value": "13738"
},
{
"key": "monads.online",
"human_key": "monads.online",
"value": "8928"
}
]
},
{
"key": "space_usage",
"data": [
{
"key": "postgresql",
"human_key": "PostgreSQL",
"value": "49581359907",
"unit": "bytes",
"human_value": "46.2 GB"
},
{
"key": "redis",
"human_key": "Redis",
"value": "100765744",
"unit": "bytes",
"human_value": "96.1 MB"
},
{
"key": "media",
"human_key": "Media storage",
"value": "837837315424",
"unit": "bytes",
"human_value": "780 GB"
}
]
},
{
"key": "software_versions",
"data": [
{
"key": "mastodon",
"human_key": "Mastodon",
"value": "3.5.1+chitter",
"human_value": "3.5.1+chitter"
},
{
"key": "ruby",
"human_key": "Ruby",
"value": "3.0.3p157",
"human_value": "3.0.3p157"
},
{
"key": "postgresql",
"human_key": "PostgreSQL",
"value": "14.3",
"human_value": "14.3"
},
{
"key": "redis",
"human_key": "Redis",
"value": "6.2.7",
"human_value": "6.2.7"
}
]
},
{
"key": "instance_languages",
"data": [
{
"key": "en",
"human_key": "English",
"value": "5848"
},
{
"key": "de",
"human_key": "German",
"value": "155"
}
]
},
{
"key": "instance_accounts",
"data": [
{
"key": "fribbledom",
"human_key": "fribbledom",
"value": "33"
},
{
"key": "ShugoWah",
"human_key": "ShugoWah",
"value": "26"
}
]
},
{
"key": "tag_servers",
"data": [
{
"key": "live.hatnix.net",
"human_key": "live.hatnix.net",
"value": "6"
},
{
"key": "linuxrocks.online",
"human_key": "linuxrocks.online",
"value": "4"
}
]
},
{
"key": "tag_languages",
"data": [
{
"key": "und",
"human_key": "und",
"value": "8"
},
{
"key": "en",
"human_key": "English",
"value": "7"
}
]
}
]
```
##### 403: Forbidden
授权用户缺少权限,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
## 另请参考
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/dimensions_controller.rb" caption="app/controllers/api/v1/admin/dimensions_controller.rb" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/lib/admin/metrics/dimension.rb" caption="app/lib/admin/metrics/dimension.rb" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/lib/admin/metrics/dimension/" caption="app/lib/admin/metrics/dimension/" >}}
{{< translation-status-zh-cn raw_title="dimensions API methods" raw_link="/methods/admin/dimensions/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,272 @@
---
title: domain_allows API 方法
description: 允许特定域名进行联合。
menu:
docs:
name: domain_allows
parent: methods-admin
identifier: methods-admin-domain_allows
aliases: [
"/methods/admin/domain_allows",
"/api/methods/admin/domain_allows",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 列出所有允许的域名 {#get}
```http
GET /api/v1/admin/domain_allows HTTP/1.1
```
显示关于所有允许的域名的信息。
**返回:** [Admin::DomainAllow]({{< relref "entities/Admin_DomainAllow" >}}) 数组\
**OAuth:** 用户令牌 + `admin:read:domain_allows`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含`Bearer <user_token>`以获得对此API方法的访问授权。
##### 查询参数
max_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
since_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
min_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
limit
: 整数。要返回的最大结果数。 默认为 100 个允许的域名。 最大 200 个允许的域名。
#### 响应
##### 200: OK
```json
[
{
"id": "2",
"domain": "mastodon",
"created_at": "2022-09-14T21:24:15.360Z"
},
{
"id": "1",
"domain": "mastodon.social",
"created_at": "2022-09-14T21:23:02.755Z"
}
]
```
由于 DomainAllow ID 通常不通过任何 API 响应公开,因此你必须解析 HTTP `Link` 标头以加载较旧或较新的结果。 有关更多信息,请参见[通过 API 响应进行分页]({{<relref "api/guidelines#pagination">}})。
```http
Link: <http://mastodon.example/api/v1/admin/domain_allows?limit=2&max_id=2>; rel="next", <http://mastodon.example/api/v1/admin/domain_allows?limit=2&since_id=1>; rel="prev"
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 获取单个允许的域名 {#get-one}
```http
GET /api/v1/admin/domain_allows/:id HTTP/1.1
```
显示有关单个允许的域名的信息。
**返回:** [Admin::DomainAllow]({{< relref "entities/Admin_DomainAllow" >}})\
**OAuth:** 用户令牌 + `admin:read:domain_allows`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 DomainAllow 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含`Bearer <user_token>`以获得对此API方法的访问授权。
#### 响应
##### 200: OK
```json
{
"id": "1",
"domain": "mastodon.social",
"created_at": "2022-09-14T21:23:02.755Z"
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
具有给定 ID 的 DomainAllow 不存在
```json
{
"error": "Record not found"
}
```
---
## 允许一个域名进行联合 {#create}
```http
POST /api/v1/admin/domain_allows HTTP/1.1
```
将一个域名添加到允许进行联合的域名列表中,当实例处于有限联合模式时使用。
**返回:** [Admin::DomainAllow]({{< relref "entities/Admin_DomainAllow" >}})\
**OAuth:** 用户令牌 + `admin:write:domain_allows`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含`Bearer <user_token>`以获得对此API方法的访问授权。
##### 表单数据参数
domain
: {{<required>}} 字符串。要允许与其进行联合的域名。
#### 响应
##### 200: OK
域名已被允许进行联合,或者已经被允许进行联合
```json
{
"id": "1",
"domain": "mastodon.social",
"created_at": "2022-09-14T21:23:02.755Z"
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 422: Unprocessable entity
未提供域名参数或域名参数无效
```json
{
"error": "Validation failed: Domain can't be blank"
}
```
---
## 删除一个允许的域名 {#delete}
```http
DELETE /api/v1/admin/domain_allows/:id HTTP/1.1
```
从允许的域名列表中删除一个域名。
**返回:** [Admin::DomainAllow]({{< relref "entities/Admin_DomainAllow" >}})\
**OAuth:** 用户令牌 + `admin:write:domain_allows`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 DomainAllow 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含`Bearer <user_token>`以获得对此API方法的访问授权。
#### 响应
##### 200: OK
允许的域名已从允许列表中删除
```json
{
"id": "4",
"domain": "*",
"created_at": "2022-09-14T21:32:44.945Z"
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
具有给定 ID 的 DomainAllow 不存在
```json
{
"error": "Record not found"
}
```
---
## 另请参考
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/domain_allows_controller.rb" caption="app/controllers/api/v1/admin/domain_allows_controller.rb" >}}
{{< translation-status-zh-cn raw_title="domain_allows API methods" raw_link="/methods/admin/domain_allows/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,406 @@
---
title: admin/domain_blocks API 方法
description: 禁止某些域名参与联合。
menu:
docs:
name: domain_blocks
parent: methods-admin
identifier: methods-admin-domain_blocks
aliases: [
"/methods/admin/domain_blocks",
"/api/methods/admin/domain_blocks",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 列出所有被屏蔽的域名 {#get}
```http
GET /api/v1/admin/domain_blocks HTTP/1.1
```
显示所有被屏蔽的域名的信息。
**返回:** [Admin::DomainBlock]({{< relref "entities/Admin_DomainBlock" >}}) 数组\
**OAuth** 用户令牌 + `admin:read:domain_blocks`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>` 以获得对此 API 方法的访问授权。
##### 查询参数
max_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
since_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
min_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
limit
: 整数。要返回的最大结果数。默认为 100 个屏蔽域名。最多 200 个屏蔽域名。
#### 响应
##### 200: OK
```json
[
{
"id": "1",
"domain": "example.com",
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
"created_at": "2022-11-16T08:15:34.238Z",
"severity": "noop",
"reject_media": false,
"reject_reports": false,
"private_comment": null,
"public_comment": null,
"obfuscate": false
},
// ...
]
```
由于 DomainBlock ID 通常不会通过任何 API 响应公开,因此你必须解析 HTTP `Link` 标头以加载较旧或较新的结果。 有关更多信息,请参见[通过 API 响应进行分页]({{<relref "api/guidelines#pagination">}})。
```http
Link: <http://mastodon.example/api/v1/admin/domain_blocks?limit=2&max_id=2>; rel="next", <http://mastodon.example/api/v1/admin/domain_blocks?limit=2&since_id=1>; rel="prev"
```
##### 403: Forbidden
授权用户无权执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 获取单个被屏蔽的域名 {#get-one}
```http
GET /api/v1/admin/domain_blocks/:id HTTP/1.1
```
显示有关单个被屏蔽域名的信息。
**返回:** [Admin::DomainBlock]({{< relref "entities/Admin_DomainBlock" >}})\
**OAuth** 用户令牌 + `admin:read:domain_blocks`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
##### 路径参数
:id
: {{<required>}} 字符串。 数据库中 DomainBlock 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>` 以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
```json
{
"id": "1",
"domain": "example.com",
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
"created_at": "2022-11-16T08:15:34.238Z",
"severity": "noop",
"reject_media": false,
"reject_reports": false,
"private_comment": null,
"public_comment": null,
"obfuscate": false
}
```
##### 403: Forbidden
授权用户无权执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
不存在具有给定 ID 的 DomainBlock
```json
{
"error": "Record not found"
}
```
---
## 阻止域名参与联合 {#create}
```http
POST /api/v1/admin/domain_blocks HTTP/1.1
```
将域名添加到被阻止参与联合的域名列表中。
**返回:** [Admin::DomainBlock]({{< relref "entities/Admin_DomainBlock" >}})\
**OAuth** 用户令牌 + `admin:write:domain_blocks`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>` 以获得对此 API 方法的访问授权。
##### 表单数据参数
domain
: {{<required>}} 字符串。 要阻止联合的域名。
severity
: 字符串。 是否对域名应用 `silence``suspend``noop`。 默认为 `silence`
reject_media
: 布尔值。 是否应拒绝媒体附件。 默认为 false
reject_reports
: 布尔值。 是否应拒绝来自此域名的举报。 默认为 false
private_comment
: 字符串。 关于此域名屏蔽的私密注释,仅管理员可见。
public_comment
: 字符串。 关于此域名屏蔽的公开注释,可以选择在“关于”页面上显示。
obfuscate
: 布尔值。 是否在公开显示时部分遮挡该域名。 默认为 false
#### 响应
##### 200: OK
该域名已被阻止参与联合。
```json
{
"id": "1",
"domain": "example.com",
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
"created_at": "2022-11-16T08:15:34.238Z",
"severity": "noop",
"reject_media": false,
"reject_reports": false,
"private_comment": null,
"public_comment": null,
"obfuscate": false
}
```
##### 403: Forbidden
授权用户无权执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 422: Unprocessable entity-缺少参数
未提供域名参数
```json
{
"error": "Validation failed: Domain can't be blank"
}
```
##### 422: Unprocessable entity-已有域名屏蔽
域名参数已包含在现有的域名屏蔽中。
```json
{
"error": "You have already imposed stricter limits on example.com."
"existing_domain_block": {
"id": "1",
"domain": "example.com",
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
"created_at": "2022-11-16T08:15:34.238Z",
"severity": "noop",
"reject_media": false,
"reject_reports": false,
"private_comment": null,
"public_comment": null,
"obfuscate": false
}
}
```
---
## 更新域名屏蔽 {#update}
```http
PUT /api/v1/admin/domain_blocks/:id HTTP/1.1
```
更改现有域名屏蔽的参数。
**返回:** [Admin::DomainBlock]({{< relref "entities/Admin_DomainBlock" >}})\
**OAuth** 用户令牌 + `admin:write:domain_blocks`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。 数据库中 DomainAllow 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>` 以获得对此 API 方法的访问授权。
##### 表单数据参数
severity
: 字符串。 是否对域名应用 `silence``suspend``noop`。 默认为 `silence`
reject_media
: 布尔值。 是否应拒绝媒体附件。 默认为 false
reject_reports
: 布尔值。 是否应拒绝来自此域名的举报。 默认为 false
private_comment
: 字符串。 关于此域名屏蔽的私密注释,仅管理员可见。
public_comment
: 字符串。 关于此域名屏蔽的公开注释,可以选择在“关于”页面上显示。
obfuscate
: 布尔值。 是否在公开显示时部分审查该域名。 默认为 false
#### 响应
##### 200: OK
域名屏蔽已更新
```json
{
"id": "1",
"domain": "example.com",
"digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947",
"created_at": "2022-11-16T08:15:34.238Z",
"severity": "noop",
"reject_media": false,
"reject_reports": false,
"private_comment": null,
"public_comment": null,
"obfuscate": false
}
```
##### 403: Forbidden
授权用户无权执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 500: 实例错误
<!-- TODO: remove when https://github.com/mastodon/mastodon/issues/21775 is fixed -->
屏蔽级别无效
---
## 删除域名屏蔽 {#delete}
```http
DELETE /api/v1/admin/domain_blocks/:id HTTP/1.1
```
取消对域名的屏蔽。
**返回:** [Admin::DomainBlock]({{< relref "entities/Admin_DomainBlock" >}})\
**OAuth** 用户令牌 + `admin:write:domain_blocks`\
**权限:** 管理联合\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。 数据库中 DomainAllow 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>` 以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
该域名已从屏蔽列表中删除
```json
{}
```
##### 403: Forbidden
授权用户无权执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
不存在具有给定 ID 的 DomainBlock
```json
{
"error": "Record not found"
}
```
---
## 另请参考
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/domain_blocks_controller.rb" caption="app/controllers/api/v1/admin/domain_blocks_controller.rb" >}}
{{< translation-status-zh-cn raw_title="domain_blocks API methods" raw_link="/methods/admin/domain_blocks/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,377 @@
---
title: email_domain_blocks API 方法
description: 禁止使用某些电子邮件域名注册。
menu:
docs:
name: email_domain_blocks
parent: methods-admin
identifier: methods-admin-email_domain_blocks
aliases: [
"/methods/admin/email_domain_blocks",
"/api/methods/admin/email_domain_blocks",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 列出所有被屏蔽的电子邮件域名 {#get}
```http
GET /api/v1/admin/email_domain_blocks HTTP/1.1
```
显示有关所有被屏蔽注册的电子邮件域名信息。
**返回:** [Admin::EmailDomainBlock]({{< relref "entities/Admin_EmailDomainBlock" >}}) 数组\
**OAuth** 用户令牌 + `admin:read:email_domain_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 查询参数
max_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
since_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
min_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
limit
: 整数。要返回的最大结果数。默认为 100 个屏蔽条目。最大 200 个屏蔽条目。
#### 响应
##### 200: OK
```json
[
{
"id": "1",
"domain": "foo",
"created_at": "2022-11-16T06:09:36.176Z",
"history": [
{
"day": "1668556800",
"accounts": "0",
"uses": "0"
},
{
"day": "1668470400",
"accounts": "0",
"uses": "0"
},
{
"day": "1668384000",
"accounts": "0",
"uses": "0"
},
{
"day": "1668297600",
"accounts": "0",
"uses": "0"
},
{
"day": "1668211200",
"accounts": "0",
"uses": "0"
},
{
"day": "1668124800",
"accounts": "0",
"uses": "0"
},
{
"day": "1668038400",
"accounts": "0",
"uses": "0"
}
]
},
// ...
]
```
##### 403: Forbidden
授权用户不允许执行此操作,或缺少或无效的 Authorization 标头。
```json
{
"error": "This action is not allowed"
}
```
---
## 获取单个被屏蔽的电子邮件域名 {#get-one}
```http
GET /api/v1/admin/email_domain_blocks/:id HTTP/1.1
```
显示有关被屏蔽注册的单个电子邮件域名信息。
**返回:** [Admin::EmailDomainBlock]({{< relref "entities/Admin_EmailDomainBlock" >}})\
**OAuth** 用户令牌 + `admin:read:email_domain_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.1.0 - 添加
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 DomainBlock 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
```json
{
"id": "1",
"domain": "foo",
"created_at": "2022-11-16T06:09:36.176Z",
"history": [
{
"day": "1668556800",
"accounts": "0",
"uses": "0"
},
{
"day": "1668470400",
"accounts": "0",
"uses": "0"
},
{
"day": "1668384000",
"accounts": "0",
"uses": "0"
},
{
"day": "1668297600",
"accounts": "0",
"uses": "0"
},
{
"day": "1668211200",
"accounts": "0",
"uses": "0"
},
{
"day": "1668124800",
"accounts": "0",
"uses": "0"
},
{
"day": "1668038400",
"accounts": "0",
"uses": "0"
}
]
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或缺少或无效的 Authorization 标头。
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
具有给定 ID 的 EmailDomainBlock 不存在
```json
{
"error": "Record not found"
}
```
---
## 屏蔽电子邮件域名 {#create}
```http
POST /api/v1/admin/email_domain_blocks HTTP/1.1
```
将域名添加到被屏蔽的电子邮件域名列表中。
**返回:** [Admin::EmailDomainBlock]({{< relref "entities/Admin_EmailDomainBlock" >}})\
**OAuth** 用户令牌 + `admin:write:email_domain_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 表单数据参数
domain
: {{<required>}} 字符串。要屏蔽与其联合的域名。
#### 响应
##### 200: OK
电子邮件域名已被屏蔽注册。
```json
{
"id": "1",
"domain": "foo",
"created_at": "2022-11-16T06:09:36.176Z",
"history": [
{
"day": "1668556800",
"accounts": "0",
"uses": "0"
},
{
"day": "1668470400",
"accounts": "0",
"uses": "0"
},
{
"day": "1668384000",
"accounts": "0",
"uses": "0"
},
{
"day": "1668297600",
"accounts": "0",
"uses": "0"
},
{
"day": "1668211200",
"accounts": "0",
"uses": "0"
},
{
"day": "1668124800",
"accounts": "0",
"uses": "0"
},
{
"day": "1668038400",
"accounts": "0",
"uses": "0"
}
]
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或缺少或无效的 Authorization 标头。
```json
{
"error": "This action is not allowed"
}
```
##### 422: Unprocessable entity
未提供 domain 参数
```json
{
"error": "Validation failed: Domain can't be blank"
}
```
或者,提供的域名包含无效字符
```json
{
"error": "Validation failed: Domain is invalid, Domain is not a valid domain name"
}
```
---
## 删除电子邮件域名屏蔽 {#delete}
```http
DELETE /api/v1/admin/email_domain_blocks/:id HTTP/1.1
```
取消对电子邮件域名的屏蔽。
**返回:** [Admin::EmailDomainBlock]({{< relref "entities/Admin_EmailDomainBlock" >}})\
**OAuth** 用户令牌 + `admin:write:email_domain_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 DomainAllow 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
电子邮件域名已从屏蔽列表中删除
```json
{}
```
##### 403: Forbidden
授权用户不允许执行此操作,或缺少或无效的 Authorization 标头。
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
具有给定 ID 的 EmailDomainBlock 不存在
```json
{
"error": "Record not found"
}
```
---
## 另请参考
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/email_domain_blocks_controller.rb" caption="app/controllers/api/v1/admin/email_domain_blocks_controller.rb" >}}
{{< translation-status-zh-cn raw_title="email_domain_blocks API methods" raw_link="/methods/admin/email_domain_blocks/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,352 @@
---
title: ip_blocks API 方法
description: 禁止某些 IP 地址段注册。
menu:
docs:
name: ip_blocks
parent: methods-admin
identifier: methods-admin-ip_blocks
aliases: [
"/methods/admin/domain_blocks",
"/api/methods/admin/domain_blocks",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 列出所有 IP 屏蔽 {#get}
```http
GET /api/v1/admin/ip_blocks HTTP/1.1
```
显示有关所有被屏蔽的 IP 段的信息。
**返回:** [Admin::IpBlock]({{< relref "entities/Admin_IpBlock" >}}) 数组\
**OAuth** 用户令牌 + `admin:read:ip_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 查询参数
max_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
since_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
min_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
limit
: 整数。要返回的最大结果数。默认为 100 个屏蔽。最多 200 个屏蔽。
#### 响应
##### 200: OK
```json
[
{
"id": "1",
"ip": "8.8.8.8/32",
"severity": "no_access",
"comment": "",
"created_at": "2022-11-16T07:22:00.501Z",
"expires_at": null
},
// ...
]
```
由于 IpBlock ID 通常不会通过任何 API 响应公开,因此你必须解析 HTTP `Link` 标头才能加载较旧或较新的结果。 有关更多信息,请参阅[通过 API 响应进行分页]({{<relref "api/guidelines#pagination">}})。
```http
Link: <http://mastodon.example/api/v1/admin/ip_blocks?limit=2&max_id=2>; rel="next", <http://mastodon.example/api/v1/admin/ip_blocks?limit=2&since_id=1>; rel="prev"
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 获取单个 IP 屏蔽条目 {#get-one}
```http
GET /api/v1/admin/ip_blocks/:id HTTP/1.1
```
显示有关单个 IP 屏蔽的信息。
**返回:** [Admin::IpBlock]({{< relref "entities/Admin_IpBlock" >}})\
**OAuth** 用户令牌 + `admin:read:ip_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 IpBlock 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
```json
{
"id": "1",
"ip": "8.8.8.8/32",
"severity": "no_access",
"comment": "",
"created_at": "2022-11-16T07:22:00.501Z",
"expires_at": null
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
具有给定 ID 的 IpBlock 不存在
```json
{
"error": "Record not found"
}
```
---
## 屏蔽 IP 地址段 {#create}
```http
POST /api/v1/admin/ip_blocks HTTP/1.1
```
将 IP 地址段添加到 IP 屏蔽列表。
**返回:** [Admin::IpBlock]({{< relref "entities/Admin_IpBlock" >}})\
**OAuth** 用户令牌 + `admin:write:ip_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 表单数据参数
ip
: 字符串。要屏蔽的 IP 地址和前缀。默认为 `0.0.0.0/32`
severity
: {{<required>}} 字符串。应用于此 IP 段的策略:`sign_up_requires_approval``sign_up_block``no_access`
comment
: 字符串。此 IP 屏蔽的原因。
expires_in
: 整数。此 IP 屏蔽距离过期的秒数。
#### 响应
##### 200: OK
IP 已被屏蔽注册。
```json
{
"id": "1",
"ip": "8.8.8.8/32",
"severity": "no_access",
"comment": "",
"created_at": "2022-11-16T07:22:00.501Z",
"expires_at": null
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 422: Unprocessable entity
IP 已被屏蔽,并且/或者未提供严重性
```json
{
"error": "Validation failed: Severity can't be blank, Ip has already been taken"
}
```
---
## 更新 IP 屏蔽 {#update}
```http
PUT /api/v1/admin/ip_blocks/:id HTTP/1.1
```
更改现有 IP 屏蔽的参数。
**返回:** [Admin::IpBlock]({{< relref "entities/Admin_IpBlock" >}})\
**OAuth** 用户令牌 + `admin:write:ip_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 IpBlock 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 表单数据参数
ip
: 字符串。要屏蔽的 IP 地址和前缀。默认为 `0.0.0.0/32`
severity
: 字符串。应用于此 IP 段的策略:`sign_up_requires_approval``sign_up_block``no_access`
comment
: 字符串。此 IP 屏蔽的原因。
expires_in
: 整数。此 IP 屏蔽距离过期的秒数。
#### 响应
##### 200: OK
IP 屏蔽已更新
```json
{
"id": "1",
"ip": "8.8.4.4/32",
"severity": "no_access",
"comment": "",
"created_at": "2022-11-16T07:22:00.501Z",
"expires_at": null
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 删除 IP 屏蔽 {#delete}
```http
DELETE /api/v1/admin/ip_blocks/:id HTTP/1.1
```
解除对 IP 段的屏蔽。
**返回:** [Admin::IpBlock]({{< relref "entities/Admin_IpBlock" >}})\
**OAuth** 用户令牌 + `admin:write:domain_blocks`\
**权限:** 管理屏蔽\
**版本历史:**\
4.0.0 - 添加
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中 DomainAllow 的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
已从屏蔽列表中删除 IP
```json
{}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
##### 404: Not found
具有给定 ID 的 IpBlock 不存在
```json
{
"error": "Record not found"
}
```
---
## 另请参考
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/ip_blocks_controller.rb" caption="app/controllers/api/v1/admin/ip_blocks_controller.rb" >}}
{{< translation-status-zh-cn raw_title="ip_blocks API methods" raw_link="/methods/admin/ip_blocks/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,300 @@
---
title: measures API 方法
description: 获取关于实例的统计指标。
menu:
docs:
name: measures
parent: methods-admin
identifier: methods-admin-measures
aliases: [
"/methods/admin/measures",
"/api/methods/admin/measures",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 获取统计数据 {#get}
```http
POST /api/v1/admin/measures HTTP/1.1
```
获取你的实例的统计数据。
**返回:** [Admin::Measure]({{< relref "entities/Admin_Measure" >}})数组\
**OAuth:** 用户令牌 + `admin:read`\
**权限:** 查看管理面板\
**版本历史:**\
3.5.0 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>` 以获得对此 API 方法的访问授权。
##### 表单数据参数
keys[]
: {{<required>}} 字符串数组。通过对应的键字符串请求特定类别的统计数据。支持的类别包括:
- `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
: {{<required>}} ([Datetime](/api/datetime-format#datetime)) 字符串。时间段的开始日期。若提供了时间,将被忽略。
end_at
: {{<required>}} ([Datetime](/api/datetime-format#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
返回每个数据的数量数据,包括聚合数据以及按数据桶划分的数据。
```json
[
{
"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 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 另请参考
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/measures_controller.rb" caption="app/controllers/api/v1/admin/measures_controller.rb" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/lib/admin/metrics/measure.rb" caption="app/lib/admin/metrics/measure.rb" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/lib/admin/metrics/measure/" caption="app/lib/admin/metrics/measure/" >}}
{{< translation-status-zh-cn raw_title="measures API methods" raw_link="/methods/admin/measures/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,552 @@
---
title: admin/reports API 方法
description: 根据举报执行管理操作。
menu:
docs:
name: reports
parent: methods-admin
identifier: methods-admin-reports
aliases: [
"/methods/admin/reports",
"/api/methods/admin/reports",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 查看所有举报 {#get}
```http
GET /api/v1/admin/reports HTTP/1.1
```
查看所有举报的信息。
**返回:** [Admin::Report]({{< relref "entities/Admin_Report" >}}) 数组\
**OAuth:** 用户令牌 + `admin:read:reports`\
**权限:** 管理举报\
**版本历史:**\
2.9.1 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,格式为 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 查询参数
resolved
: 布尔值。是否过滤已解决的举报?
account_id
: 字符串。筛选由此帐户提交的举报。
target_account_id
: 字符串。筛选以此帐户为目标账户的举报。
max_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
since_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
min_id
: **内部参数。** 使用 HTTP `Link` 标头进行分页。
limit
: 整数。要返回的最大结果数。默认为 100 个举报。最大为 200 个举报。
#### 响应
##### 200: OK
```json
[
{
"id": "3",
"action_taken": false,
"action_taken_at": null,
"category": "spam",
"comment": "",
"forwarded": false,
"created_at": "2022-09-09T21:19:23.085Z",
"updated_at": "2022-09-09T21:19:23.085Z",
"account": {
"id": "108965218747268792",
"username": "admin",
"domain": null,
"created_at": "2022-09-08T22:48:07.985Z",
"email": "admin@mastodon.local",
// ...
"account": {
"id": "108965218747268792",
"username": "admin",
"acct": "admin",
// ...
}
},
"target_account": {
"id": "108965430868193066",
"username": "goody",
"domain": null,
"created_at": "2022-09-08T23:42:04.731Z",
"email": "goody@mastodon.local",
// ...
"account": {
"id": "108965430868193066",
"username": "goody",
"acct": "goody",
// ...
}
},
"assigned_account": null,
"action_taken_by_account": null,
"statuses": [],
"rules": []
},
// ...
]
```
由于举报 ID 通常不会通过任何 API 响应公开,因此你必须解析 HTTP `Link` 标头才能加载更早或更新的结果。 有关更多信息,请参考[通过 API 响应进行分页]({{<relref "api/guidelines#pagination">}})。
```http
Link: <http://mastodon.example/api/v1/admin/reports?limit=2&max_id=2>; rel="next", <http://mastodon.example/api/v1/admin/reports?limit=2&since_id=1>; rel="prev"
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 查看单个举报 {#get-one}
```http
GET /api/v1/admin/reports/:id HTTP/1.1
```
**返回:** [Admin::Report]({{< relref "entities/Admin_Report" >}})\
**OAuth:** 用户令牌 + `admin:read:reports`\
**权限:** 管理举报\
**版本历史:**\
2.9.1 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中举报的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,格式为 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
```json
{
"id": "2",
"action_taken": true,
"action_taken_at": "2022-09-09T21:38:54.679Z",
"category": "spam",
"comment": "",
"forwarded": false,
"created_at": "2022-09-09T21:19:44.021Z",
"updated_at": "2022-09-09T21:38:54.681Z",
"account": {
"id": "108965218747268792",
"username": "admin",
"domain": null,
"created_at": "2022-09-08T22:48:07.985Z",
"email": "admin@mastodon.local",
// ...
"account": {
"id": "108965218747268792",
"username": "admin",
"acct": "admin",
// ...
}
},
"target_account": {
"id": "108965430868193066",
"username": "goody",
"domain": null,
"created_at": "2022-09-08T23:42:04.731Z",
"email": "goody@mastodon.local",
// ...
"account": {
"id": "108965430868193066",
"username": "goody",
"acct": "goody",
// ...
}
},
"assigned_account": null,
"action_taken_by_account": {
"id": "108965218747268792",
"username": "admin",
"domain": null,
"created_at": "2022-09-08T22:48:07.985Z",
"email": "admin@mastodon.local",
// ...
"account": {
"id": "108965218747268792",
"username": "admin",
"acct": "admin",
// ...
}
},
"statuses": [],
"rules": []
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 更新举报 {#update}
```http
PUT /api/v1/admin/reports/:id HTTP/1.1
```
更改举报的元数据。
**返回:** [Admin::Report]({{< relref "entities/Admin_Report" >}})\
**OAuth:** 用户令牌 + `admin:write:reports`\
**权限:** 管理举报\
**版本历史:**\
3.5.0 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中举报的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,格式为 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### 表单数据参数
category
: 字符串。将举报的分类更改为 `spam``violation``other`
rule_ids[]
: 整数数组。对于 `violation` 类别的举报,指定违反的确切规则的 ID。规则及其 ID 可通过 [GET /api/v1/instance/rules]({{< relref "methods/instance#rules" >}}) 和 [GET /api/v1/instance]({{< relref "methods/instance#get" >}}) 获取。
#### 响应
##### 200: OK
举报类别和/或规则 ID 现在应该已更新。
```json
{
"id": "3",
"action_taken": false,
"action_taken_at": null,
"category": "other",
// ...
"rules": []
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 将举报分配给自己 {#assign_to_self}
```http
POST /api/v1/admin/reports/:id/assign_to_self HTTP/1.1
```
声明对此举报的处理权。
**返回:** [Admin::Report]({{< relref "entities/Admin_Report" >}})\
**OAuth:** 用户令牌 + `admin:write:reports`\
**权限:** 管理举报\
**版本历史:**\
2.9.1 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中举报的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,格式为 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
举报现在应该已分配给你,或者它已经分配给你。
```json
{
"id": "3",
"action_taken": false,
"action_taken_at": null,
"category": "other",
"comment": "",
"forwarded": false,
"created_at": "2022-09-09T21:21:01.204Z",
"updated_at": "2022-09-11T14:39:01.531Z",
// ...
"assigned_account": {
"id": "108965218747268792",
"username": "admin",
"domain": null,
"created_at": "2022-09-08T22:48:07.985Z",
"email": "admin@mastodon.local",
// ...
"account": {
"id": "108965218747268792",
"username": "admin",
"acct": "admin",
// ...
}
},
"action_taken_by_account": null,
"statuses": [],
"rules": []
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 取消举报分配 {#unassign}
```http
POST /api/v1/admin/reports/:id/unassign HTTP/1.1
```
取消分配举报,以便其他人可以认领它。
**返回:** [Admin::Report]({{< relref "entities/Admin_Report" >}})\
**OAuth:** 用户令牌 + `admin:write:reports`\
**权限:** 管理举报\
**版本历史:**\
2.9.1 - 添加
4. 0.0 - 支持自定义用户组和权限
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中举报的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,格式为 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
举报应该不再分配给你,或者它已经没有分配给任何人。
```json
{
"id": "3",
"action_taken": false,
"action_taken_at": null,
"category": "other",
"comment": "",
"forwarded": false,
"created_at": "2022-09-09T21:21:01.204Z",
"updated_at": "2022-09-11T14:39:01.531Z",
// ...
"assigned_account": null,
"action_taken_by_account": null,
"statuses": [],
"rules": []
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 将举报标记为已解决 {#resolve}
```http
POST /api/v1/admin/reports/:id/resolve HTTP/1.1
```
将举报标记为已解决,无需采取进一步措施。
**返回:** [Admin::Report]({{< relref "entities/Admin_Report" >}})\
**OAuth:** 用户令牌 + `admin:write:reports`\
**权限:** 管理举报\
**版本历史:**\
2.9.1 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中举报的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,格式为 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
举报现在已解决,或者它已经解决。
```json
{
"id": "2",
"action_taken": true,
"action_taken_at": "2022-09-11T14:46:22.936Z",
"category": "spam",
"comment": "",
"forwarded": false,
"created_at": "2022-09-09T21:19:44.021Z",
"updated_at": "2022-09-11T14:46:22.945Z",
// ...
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 重新打开已关闭的举报 {#reopen}
```http
POST /api/v1/admin/reports/:id/reopen HTTP/1.1
```
若举报已关闭,则重新打开当前已关闭的举报。
**返回:** [Admin::Report]({{< relref "entities/Admin_Report" >}})\
**OAuth:** 用户令牌 + `admin:write:reports`\
**权限:** 管理举报\
**版本历史:**\
2.9.1 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 路径参数
:id
: {{<required>}} 字符串。数据库中举报的 ID。
##### 标头
Authorization
: {{<required>}} 提供此标头,格式为 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
该举报不再有任何已采取的措施,或者它已经没有任何已采取的措施。
```json
{
"id": "2",
"action_taken": false,
"action_taken_at": null,
"category": "spam",
"comment": "",
"forwarded": false,
"created_at": "2022-09-09T21:19:44.021Z",
"updated_at": "2022-09-11T14:42:21.855Z",
// ...
}
```
##### 403: Forbidden
授权用户不允许执行此操作,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 另请参考
{{< page-relref ref="methods/admin/accounts#action" caption="POST /api/v1/admin/accounts/:id/action" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/reports_controller.rb" caption="app/controllers/api/v1/admin/reports_controller.rb" >}}
{{< translation-status-zh-cn raw_title="reports API methods" raw_link="/methods/admin/reports/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,175 @@
---
title: retention API 方法
description: 展示对应时段的留存率数据。
menu:
docs:
name: retention
parent: methods-admin
identifier: methods-admin-retention
aliases: [
"/methods/admin/retention",
"/api/methods/admin/retention",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 计算留存率数据 {#create}
```http
POST /api/v1/admin/retention HTTP/1.1
```
为给定的时间段和桶生成留存率数据报告。
**返回:** [Admin::Cohort]({{< relref "entities/Admin_Cohort" >}}) 数组\
**OAuth:** 用户令牌 + `admin:read`\
**权限:** 查看管理面板\
**版本历史:**\
3.5.0 - 添加\
4.0.0 - 支持自定义用户组和权限
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,格式为 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
##### Form data parameters
start_at
: {{<required>}} ([Datetime](/api/datetime-format#datetime)) 字符串。时间段的开始日期。若提供了时间,则将被忽略。
end_at
: {{<required>}} ([Datetime](/api/datetime-format#datetime)) 字符串。时间段的结束日期。若提供了时间,则将被忽略。
frequency
: {{<required>}} 字符串(枚举值之一)。指定是否使用 `day``month` 存储桶。若提供任何其他值,则默认为 `day`
#### 响应
##### 200: OK
2022 年 9 月的每月留存率数据,假设 2 个用户在 2022 年 9 月注册,并且在该月至少活跃一次。
```json
[
{
"period": "2022-09-01T00:00:00+00:00",
"frequency": "month",
"data": [
{
"date": "2022-09-01T00:00:00+00:00",
"rate": 1.0,
"value": "2"
}
]
}
]
```
2022 年 9 月 8 日至 2022 年 9 月 14 日之间的一周的每日留存率数据,假设 2 个用户在 2022 年 9 月 8 日注册,并且其中 1 个用户在 2022 年 9 月 9 日之后停止活跃。
```json
[
{
"period": "2022-09-08T00:00:00+00:00",
"frequency": "day",
"data": [
{
"date": "2022-09-08T00:00:00+00:00",
"rate": 1,
"value": "2"
},
{
"date": "2022-09-09T00:00:00+00:00",
"rate": 1,
"value": "2"
},
{
"date": "2022-09-10T00:00:00+00:00",
"rate": 0.5,
"value": "1"
},
// ...
{
"date": "2022-09-14T00:00:00+00:00",
"rate": 0.5,
"value": "1"
}
]
},
{
"period": "2022-09-09T00:00:00+00:00",
"frequency": "day",
"data": [
{
"date": "2022-09-09T00:00:00+00:00",
"rate": 0,
"value": "0"
},
// ...
{
"date": "2022-09-14T00:00:00+00:00",
"rate": 0,
"value": "0"
}
]
},
{
"period": "2022-09-10T00:00:00+00:00",
"frequency": "day",
"data": [
{
"date": "2022-09-10T00:00:00+00:00",
"rate": 0,
"value": "0"
},
// ...
{
"date": "2022-09-14T00:00:00+00:00",
"rate": 0,
"value": "0"
}
]
},
// ...
{
"period": "2022-09-14T00:00:00+00:00",
"frequency": "day",
"data": [
{
"date": "2022-09-14T00:00:00+00:00",
"rate": 0,
"value": "0"
}
]
}
]
```
若缺少任何参数,同类组计算将失败并返回一个空数组。
```json
[]
```
##### 403: Forbidden
授权用户缺少权限,或者 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
---
## 另请参考
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/retention_controller.rb" caption="app/controllers/api/v1/admin/retention_controller.rb" >}}
{{< translation-status-zh-cn raw_title="retention API methods" raw_link="/methods/admin/retention/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}

View file

@ -0,0 +1,263 @@
---
title: admin/trends API 方法
description: TODO
menu:
docs:
name: trends
parent: methods-admin
identifier: methods-admin-trends
aliases: [
"/methods/admin/measures",
"/api/methods/admin/measures",
]
---
<style>
#TableOfContents ul ul ul {display: none}
</style>
## 查看热门链接 {#links}
```http
GET /api/v1/admin/trends/links HTTP/1.1
```
比其他链接分享更多的链接,包括未批准和未审核的链接。
**返回:** [Trends::Link]({{< relref "entities/PreviewCard#trends-link" >}}) 数组\
**OAuth:** 用户令牌 + `admin:read`\
**权限:** 管理分类\
**版本历史:**\
3.5.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
```json
[
{
"url": "https://twitter.com/arufa_faru/status/1594262272007753728",
"title": "ARuFa on Twitter",
"description": "“言葉をマネするぬいぐるみを改造してエレキギターを直接繋いでみました”",
"type": "link",
"author_name": "",
"author_url": "",
"provider_name": "Twitter",
"provider_url": "",
"html": "",
"width": 400,
"height": 225,
"image": "https://media.chitter.xyz/cache/preview_cards/images/002/162/720/original/b5360261e8ce17fc.jpeg",
"embed_url": "",
"blurhash": "UNFiDM~o-oD%x[xtaxM|xaNHRkjsoft7ofWB",
"history": [
{
"day": "1669507200",
"accounts": "9",
"uses": "9"
},
{
"day": "1669420800",
"accounts": "0",
"uses": "0"
},
{
"day": "1669334400",
"accounts": "0",
"uses": "0"
},
{
"day": "1669248000",
"accounts": "0",
"uses": "0"
},
{
"day": "1669161600",
"accounts": "0",
"uses": "0"
},
{
"day": "1669075200",
"accounts": "0",
"uses": "0"
},
{
"day": "1668988800",
"accounts": "0",
"uses": "0"
}
]
},
// ...
]
```
##### 403: Forbidden
授权用户缺少权限,或 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
## 查看热门嘟文 {#statuses}
```http
GET /api/v1/admin/trends/statuses HTTP/1.1
```
比其他嘟文互动更多的嘟文,包括未批准和未审核的嘟文。
**返回:** [Status]({{< relref "entities/Status" >}}) 数组\
**OAuth:** 用户令牌 + `admin:read`\
**权限:** 管理分类\
**版本历史:**\
3.5.0 - 添加
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
```json
[
{
"id": "109415512969053017",
"created_at": "2022-11-27T11:23:52.000Z",
"in_reply_to_id": null,
"in_reply_to_account_id": null,
// ...
"account": {
"id": "109332240210946752",
// ...
},
"media_attachments": [],
"mentions": [],
"tags": [],
"emojis": [],
"card": null,
"poll": null
},
// ...
]
```
##### 403: Forbidden
授权用户缺少权限,或 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
## 查看热门话题标签 {#tags}
```http
GET /api/v1/admin/trends/tags HTTP/1.1
```
过去一周内使用频率更高的话题标签,包括未批准和未审核的话题标签。
**返回:** [Admin::Tag]({{< relref "entities/Tag#admin" >}}) 数组\
**OAuth:** 用户令牌 + `admin:read`\
**权限:** 管理分类\
**版本历史:**\
3.5.0 - 添加\
4.0.0 - 由于错误,返回 Tag 数组\
4.1.0 - 修复错误 <!-- TODO: https://github.com/mastodon/mastodon/pull/18943 -->
#### 请求
##### 标头
Authorization
: {{<required>}} 提供此标头,其中包含 `Bearer <user_token>`,以获得对此 API 方法的访问授权。
#### 响应
##### 200: OK
```json
[
{
"name": "caturday",
"url": "https://mastodon.example/tags/caturday",
"history": [
{
"day": "1669507200",
"accounts": "53",
"uses": "56"
},
{
"day": "1669420800",
"accounts": "142",
"uses": "171"
},
{
"day": "1669334400",
"accounts": "11",
"uses": "11"
},
{
"day": "1669248000",
"accounts": "8",
"uses": "9"
},
{
"day": "1669161600",
"accounts": "8",
"uses": "20"
},
{
"day": "1669075200",
"accounts": "11",
"uses": "11"
},
{
"day": "1668988800",
"accounts": "17",
"uses": "22"
}
],
"id": "802",
"trendable": true,
"usable": true,
"requires_review": false
},
]
```
##### 403: Forbidden
授权用户缺少权限,或 Authorization 标头无效或缺失
```json
{
"error": "This action is not allowed"
}
```
## 另请参考
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/trends/links_controller.rb" caption="app/controllers/api/v1/admin/trends/links_controller.rb" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/trends/statuses_controller.rb" caption="app/controllers/api/v1/admin/trends/statuses_controller.rb" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/admin/trends/tags_controller.rb" caption="app/controllers/api/v1/admin/trends/tags_controller.rb" >}}
{{< translation-status-zh-cn raw_title="trends API methods" raw_link="/methods/admin/trends/" last_translation_time="2025-04-06" raw_commit="5e2b739ee193896bea937addc2843146ea0bc870">}}