debian-mirror-gitlab/doc/api/releases/links.md

193 lines
5.8 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
stage: Release
group: Release Management
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
2019-02-15 15:39:39 +05:30
# Release links API
2020-06-23 00:09:42 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41766) in GitLab 11.7.
2019-02-15 15:39:39 +05:30
Using this API you can manipulate GitLab's [Release](../../user/project/releases/index.md) links. For manipulating other Release assets, see [Release API](index.md).
2020-04-22 19:07:51 +05:30
GitLab supports links to `http`, `https`, and `ftp` assets.
2019-02-15 15:39:39 +05:30
## Get links
Get assets as links from a Release.
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
GET /projects/:id/releases/:tag_name/assets/links
```
| Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | --------------------------------------- |
2019-07-07 11:18:12 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../README.md#namespaced-path-encoding). |
2019-02-15 15:39:39 +05:30
| `tag_name` | string | yes | The tag associated with the Release. |
Example request:
2020-03-13 15:44:24 +05:30
```shell
2020-05-24 23:13:21 +05:30
curl --header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
[
{
"id":2,
"name":"awesome-v0.2.msi",
"url":"http://192.168.10.15:3000/msi",
2020-06-23 00:09:42 +05:30
"external":true,
"link_type":"other"
2019-02-15 15:39:39 +05:30
},
{
"id":1,
"name":"awesome-v0.2.dmg",
"url":"http://192.168.10.15:3000",
2020-06-23 00:09:42 +05:30
"external":true,
"link_type":"other"
2019-02-15 15:39:39 +05:30
}
]
```
## Get a link
Get an asset as a link from a Release.
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
GET /projects/:id/releases/:tag_name/assets/links/:link_id
```
| Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | --------------------------------------- |
2019-07-07 11:18:12 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../README.md#namespaced-path-encoding). |
2019-02-15 15:39:39 +05:30
| `tag_name` | string | yes | The tag associated with the Release. |
2020-05-24 23:13:21 +05:30
| `link_id` | integer | yes | The ID of the link. |
2019-02-15 15:39:39 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2020-05-24 23:13:21 +05:30
curl --header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
{
"id":1,
"name":"awesome-v0.2.dmg",
"url":"http://192.168.10.15:3000",
2020-06-23 00:09:42 +05:30
"external":true,
"link_type":"other"
2019-02-15 15:39:39 +05:30
}
```
## Create a link
Create an asset as a link from a Release.
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
POST /projects/:id/releases/:tag_name/assets/links
```
| Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | --------------------------------------- |
2019-07-07 11:18:12 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../README.md#namespaced-path-encoding). |
2019-02-15 15:39:39 +05:30
| `tag_name` | string | yes | The tag associated with the Release. |
| `name` | string | yes | The name of the link. |
2020-06-23 00:09:42 +05:30
| `url` | string | yes | The URL of the link. |
| `link_type` | string | no | The type of the link: `other`, `runbook`, `image`, `package`. Defaults to `other`. |
2019-02-15 15:39:39 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2019-02-15 15:39:39 +05:30
curl --request POST \
2020-05-24 23:13:21 +05:30
--header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" \
2019-02-15 15:39:39 +05:30
--data name="awesome-v0.2.dmg" \
--data url="http://192.168.10.15:3000" \
2019-10-12 21:52:04 +05:30
"https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
{
"id":1,
"name":"awesome-v0.2.dmg",
"url":"http://192.168.10.15:3000",
2020-06-23 00:09:42 +05:30
"external":true,
"link_type":"other"
2019-02-15 15:39:39 +05:30
}
```
## Update a link
Update an asset as a link from a Release.
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
PUT /projects/:id/releases/:tag_name/assets/links/:link_id
```
| Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | --------------------------------------- |
2019-07-07 11:18:12 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../README.md#namespaced-path-encoding). |
2019-02-15 15:39:39 +05:30
| `tag_name` | string | yes | The tag associated with the Release. |
2020-06-23 00:09:42 +05:30
| `link_id` | integer | yes | The ID of the link. |
2019-02-15 15:39:39 +05:30
| `name` | string | no | The name of the link. |
2020-06-23 00:09:42 +05:30
| `url` | string | no | The URL of the link. |
| `link_type` | string | no | The type of the link: `other`, `runbook`, `image`, `package`. Defaults to `other`. |
2019-02-15 15:39:39 +05:30
2020-07-28 23:09:34 +05:30
NOTE: **Note:**
2019-02-15 15:39:39 +05:30
You have to specify at least one of `name` or `url`
Example request:
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
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"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
{
"id":1,
"name":"new name",
"url":"http://192.168.10.15:3000",
2020-06-23 00:09:42 +05:30
"external":true,
"link_type":"runbook"
2019-02-15 15:39:39 +05:30
}
```
## Delete a link
Delete an asset as a link from a Release.
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
DELETE /projects/:id/releases/:tag_name/assets/links/:link_id
```
| Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | --------------------------------------- |
2019-07-07 11:18:12 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../README.md#namespaced-path-encoding). |
2019-02-15 15:39:39 +05:30
| `tag_name` | string | yes | The tag associated with the Release. |
2020-05-24 23:13:21 +05:30
| `link_id` | integer | yes | The ID of the link. |
2019-02-15 15:39:39 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2020-05-24 23:13:21 +05:30
curl --request DELETE --header "PRIVATE-TOKEN: n671WNGecHugsdEDPsyo" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
{
"id":1,
"name":"new name",
"url":"http://192.168.10.15:3000",
2020-06-23 00:09:42 +05:30
"external":true,
"link_type":"other"
2019-02-15 15:39:39 +05:30
}
```