Release links API

原文:https://docs.gitlab.com/ee/api/releases/links.html

Release links API

在 GitLab 11.7 中引入 .

使用此 API,您可以操纵 GitLab 的Release链接. 有关操纵其他 Release 资产的信息,请参见Release API . GitLab 支持指向httphttpsftp资产的链接.

从发布中获取资产作为链接.

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 /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"  } 

从发布创建资产作为链接.

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 链接的类型: otherrunbookimagepackage . 默认为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"  } 

将资产更新为发布中的链接.

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 链接的类型: otherrunbookimagepackage . 默认为other .

注意您必须至少指定nameurl

请求示例:

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 /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"  } 
Copyright © 温玉 2021 | 浙ICP备2020032454号 all right reserved,powered by Gitbook该文件修订时间: 2021-03-27 13:48:25

results matching ""

    No results matching ""