{{< details >}}
- Tier: 基础版, 专业版, 旗舰版
- Offering: JihuLab.com, 私有化部署
{{< /details >}}
Markdown 上传是上传到群组的文件,可以在史诗或 wiki 页面中的 Markdown 文本中引用。
列出上传
{{< history >}}
- 引入于极狐GitLab 17.2。
{{< /history >}}
获取按 created_at
降序排序的群组的所有上传。您必须至少拥有维护者角色才能使用此端点。
GET /groups/:id/uploads
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 群组的 ID 或 URL 编码路径。 |
示例请求:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/uploads"
示例响应:
[
{
"id": 1,
"size": 1024,
"filename": "image.png",
"created_at":"2024-06-20T15:53:03.067Z",
"uploaded_by": {
"id": 18,
"name" : "Alexandra Bashirian",
"username" : "eileen.lowe"
}
},
{
"id": 2,
"size": 512,
"filename": "other-image.png",
"created_at":"2024-06-19T15:53:03.067Z",
"uploaded_by": null
}
]
根据 ID 下载上传的文件
{{< history >}}
- 引入于极狐GitLab 17.2。
{{< /history >}}
您必须至少拥有维护者角色才能使用此端点。
GET /groups/:id/uploads/:upload_id
支持的属性:
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 群组的 ID 或 URL 编码路径。 |
upload_id |
integer | 是 | 上传的 ID。 |
示例请求:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/uploads/1"
如果成功,将返回 200
状态码,并在响应主体中包含上传的文件。
根据密钥和文件名下载上传的文件
{{< history >}}
- 引入于极狐GitLab 17.4。
{{< /history >}}
您必须至少拥有访客角色才能使用此端点。
GET /groups/:id/uploads/:secret/:filename
支持的属性:
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 群组的 ID 或 URL 编码路径。 |
secret |
string | 是 | 上传的 32 个字符的密钥。 |
filename |
string | 是 | 上传的文件名。 |
示例请求:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/uploads/648d97c6eef5fc5df8d1004565b3ee5a/sample.jpg"
如果成功,将返回 200
状态码,并在响应主体中包含上传的文件。
根据 ID 删除上传的文件
{{< history >}}
- 引入于极狐GitLab 17.2。
{{< /history >}}
您必须至少拥有维护者角色才能使用此端点。
DELETE /groups/:id/uploads/:upload_id
支持的属性:
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 群组的 ID 或 URL 编码路径。 |
upload_id |
integer | 是 | 上传的 ID。 |
示例请求:
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/uploads/1"
如果成功,将返回 204
状态码,不带任何响应主体。
根据密钥和文件名删除上传的文件
{{< history >}}
- 引入于极狐GitLab 17.4。
{{< /history >}}
您必须至少拥有维护者角色才能使用此端点。
DELETE /groups/:id/uploads/:secret/:filename
支持的属性:
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 群组的 ID 或 URL 编码路径。 |
secret |
string | 是 | 上传的 32 个字符的密钥。 |
filename |
string | 是 | 上传的文件名。 |
示例请求:
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/uploads/648d97c6eef5fc5df8d1004565b3ee5a/sample.jpg"
如果成功,将返回 204
状态码,不带任何响应主体。