Release links API
Release links API
在 GitLab 11.7 中引入 .
使用此 API,您可以操纵 GitLab 的Release链接. 有关操纵其他 Release 资产的信息,请参见Release API . GitLab 支持指向http
, https
和ftp
资产的链接.
Get links
从发布中获取资产作为链接.
GET /projects/:id/releases/:tag_name/assets/links
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 项目的 ID 或URL 编码的路径 . |
tag_name |
string | yes | 与发行版关联的标签. |
请求示例:
curl --header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links"
响应示例:
[ { "id":2, "name":"awesome-v0.2.msi", "url":"http://192.168.10.15:3000/msi", "external":true, "link_type":"other" }, { "id":1, "name":"awesome-v0.2.dmg", "url":"http://192.168.10.15:3000", "external":true, "link_type":"other" } ]
Get a link
从发布中获取资产作为链接.
GET /projects/:id/releases/:tag_name/assets/links/:link_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 项目的 ID 或URL 编码的路径 . |
tag_name |
string | yes | 与发行版关联的标签. |
link_id |
integer | yes | 链接的 ID. |
请求示例:
curl --header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1"
响应示例:
{ "id":1, "name":"awesome-v0.2.dmg", "url":"http://192.168.10.15:3000", "external":true, "link_type":"other" }
Create a link
从发布创建资产作为链接.
POST /projects/:id/releases/:tag_name/assets/links
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 项目的 ID 或URL 编码的路径 . |
tag_name |
string | yes | 与发行版关联的标签. |
name |
string | yes | 链接的名称. |
url |
string | yes | 链接的 URL. |
link_type |
string | no | 链接的类型: other , runbook , image , package . 默认为other . |
请求示例:
curl --request POST \
--header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" \
--data name="awesome-v0.2.dmg" \
--data url="http://192.168.10.15:3000" \
"https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links"
响应示例:
{ "id":1, "name":"awesome-v0.2.dmg", "url":"http://192.168.10.15:3000", "external":true, "link_type":"other" }
Update a link
将资产更新为发布中的链接.
PUT /projects/:id/releases/:tag_name/assets/links/:link_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 项目的 ID 或URL 编码的路径 . |
tag_name |
string | yes | 与发行版关联的标签. |
link_id |
integer | yes | 链接的 ID. |
name |
string | no | 链接的名称. |
url |
string | no | 链接的 URL. |
link_type |
string | no | 链接的类型: other , runbook , image , package . 默认为other . |
注意您必须至少指定name
或url
请求示例:
curl --request PUT --data name="new name" --data link_type="runbook" --header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1"
响应示例:
{ "id":1, "name":"new name", "url":"http://192.168.10.15:3000", "external":true, "link_type":"runbook" }
Delete a link
从发布中删除资产作为链接.
DELETE /projects/:id/releases/:tag_name/assets/links/:link_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 项目的 ID 或URL 编码的路径 . |
tag_name |
string | yes | 与发行版关联的标签. |
link_id |
integer | yes | 链接的 ID. |
请求示例:
curl --request DELETE --header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1"
响应示例:
{ "id":1, "name":"new name", "url":"http://192.168.10.15:3000", "external":true, "link_type":"other" }