debian-mirror-gitlab/doc/api/tags.md

228 lines
5.9 KiB
Markdown
Raw Normal View History

2017-09-10 17:25:29 +05:30
# Tags API
2015-11-26 14:37:03 +05:30
## List project repository tags
2017-08-17 22:00:37 +05:30
Get a list of repository tags from a project, sorted by name in reverse
alphabetical order. This endpoint can be accessed without authentication if the
repository is publicly accessible.
2015-11-26 14:37:03 +05:30
```
GET /projects/:id/repository/tags
```
Parameters:
2018-03-17 18:26:18 +05:30
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string| yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user|
| `order_by` | string | no | Return tags ordered by `name` or `updated` fields. Default is `updated` |
| `sort` | string | no | Return tags sorted in `asc` or `desc` order. Default is `desc` |
2015-11-26 14:37:03 +05:30
```json
[
{
"commit": {
2017-09-10 17:25:29 +05:30
"id": "2695effb5807a22ff3d138d593fd856244e155e7",
"short_id": "2695effb",
"title": "Initial commit",
"created_at": "2017-07-26T11:08:53.000+02:00",
"parent_ids": [
"2a4b78934375d7f53875269ffd4f45fd83a84ebe"
],
"message": "Initial commit",
2015-11-26 14:37:03 +05:30
"author_name": "John Smith",
"author_email": "john@example.com",
"authored_date": "2012-05-28T04:42:42-07:00",
"committer_name": "Jack Smith",
"committer_email": "jack@example.com",
2017-09-10 17:25:29 +05:30
"committed_date": "2012-05-28T04:42:42-07:00"
2015-11-26 14:37:03 +05:30
},
"release": {
"tag_name": "1.0.0",
"description": "Amazing release. Wow"
},
"name": "v1.0.0",
2018-10-15 14:42:47 +05:30
"target": "2695effb5807a22ff3d138d593fd856244e155e7",
2015-11-26 14:37:03 +05:30
"message": null
}
]
```
2016-06-02 11:05:42 +05:30
## Get a single repository tag
2017-08-17 22:00:37 +05:30
Get a specific repository tag determined by its name. This endpoint can be
accessed without authentication if the repository is publicly accessible.
2016-06-02 11:05:42 +05:30
```
GET /projects/:id/repository/tags/:tag_name
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
2017-08-17 22:00:37 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
2016-06-02 11:05:42 +05:30
| `tag_name` | string | yes | The name of the tag |
```bash
2019-02-15 15:39:39 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/repository/tags/v1.0.0
2016-06-02 11:05:42 +05:30
```
Example Response:
```json
{
"name": "v5.0.0",
"message": null,
2018-10-15 14:42:47 +05:30
"target": "60a8ff033665e1207714d6670fcd7b65304ec02f",
2016-06-02 11:05:42 +05:30
"commit": {
"id": "60a8ff033665e1207714d6670fcd7b65304ec02f",
2017-09-10 17:25:29 +05:30
"short_id": "60a8ff03",
"title": "Initial commit",
"created_at": "2017-07-26T11:08:53.000+02:00",
2016-06-02 11:05:42 +05:30
"parent_ids": [
"f61c062ff8bcbdb00e0a1b3317a91aed6ceee06b"
],
2017-09-10 17:25:29 +05:30
"message": "v5.0.0\n",
2016-06-02 11:05:42 +05:30
"author_name": "Arthur Verschaeve",
"author_email": "contact@arthurverschaeve.be",
2017-09-10 17:25:29 +05:30
"authored_date": "2015-02-01T21:56:31.000+01:00",
2016-06-02 11:05:42 +05:30
"committer_name": "Arthur Verschaeve",
2017-09-10 17:25:29 +05:30
"committer_email": "contact@arthurverschaeve.be",
"committed_date": "2015-02-01T21:56:31.000+01:00"
2016-06-02 11:05:42 +05:30
},
"release": null
}
```
2015-11-26 14:37:03 +05:30
## Create a new tag
Creates a new tag in the repository that points to the supplied ref.
```
POST /projects/:id/repository/tags
```
Parameters:
2017-08-17 22:00:37 +05:30
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
2015-11-26 14:37:03 +05:30
- `tag_name` (required) - The name of a tag
- `ref` (required) - Create tag using commit SHA, another tag name, or branch name.
- `message` (optional) - Creates annotated tag.
- `release_description` (optional) - Add release notes to the git tag and store it in the GitLab database.
```json
{
"commit": {
2017-09-10 17:25:29 +05:30
"id": "2695effb5807a22ff3d138d593fd856244e155e7",
"short_id": "2695effb",
"title": "Initial commit",
"created_at": "2017-07-26T11:08:53.000+02:00",
"parent_ids": [
"2a4b78934375d7f53875269ffd4f45fd83a84ebe"
],
"message": "Initial commit",
2015-11-26 14:37:03 +05:30
"author_name": "John Smith",
"author_email": "john@example.com",
"authored_date": "2012-05-28T04:42:42-07:00",
"committer_name": "Jack Smith",
"committer_email": "jack@example.com",
2017-09-10 17:25:29 +05:30
"committed_date": "2012-05-28T04:42:42-07:00"
2015-11-26 14:37:03 +05:30
},
"release": {
"tag_name": "1.0.0",
"description": "Amazing release. Wow"
},
"name": "v1.0.0",
2018-12-13 13:39:08 +05:30
"target": "2695effb5807a22ff3d138d593fd856244e155e7",
2015-11-26 14:37:03 +05:30
"message": null
}
```
2018-03-17 18:26:18 +05:30
The message will be `null` when creating a lightweight tag otherwise
2015-11-26 14:37:03 +05:30
it will contain the annotation.
2018-10-15 14:42:47 +05:30
The target will contain the tag objects ID when creating annotated tags,
otherwise it will contain the commit ID when creating lightweight tags.
2017-08-17 22:00:37 +05:30
In case of an error,
status code `405` with an explaining error message is returned.
2015-11-26 14:37:03 +05:30
## Delete a tag
2017-08-17 22:00:37 +05:30
Deletes a tag of a repository with given name.
```
DELETE /projects/:id/repository/tags/:tag_name
```
Parameters:
2017-08-17 22:00:37 +05:30
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
- `tag_name` (required) - The name of a tag
2015-11-26 14:37:03 +05:30
## Create a new release
2017-08-17 22:00:37 +05:30
Add release notes to the existing git tag. If there
already exists a release for the given tag, status code `409` is returned.
2015-11-26 14:37:03 +05:30
```
POST /projects/:id/repository/tags/:tag_name/release
```
Parameters:
2017-08-17 22:00:37 +05:30
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
2015-11-26 14:37:03 +05:30
- `tag_name` (required) - The name of a tag
2018-11-20 20:47:30 +05:30
Request body:
2015-11-26 14:37:03 +05:30
- `description` (required) - Release notes with markdown support
2018-11-20 20:47:30 +05:30
```json
{
"description": "Amazing release. Wow"
}
```
Response:
2015-11-26 14:37:03 +05:30
```json
{
"tag_name": "1.0.0",
"description": "Amazing release. Wow"
}
```
## Update a release
2017-08-17 22:00:37 +05:30
Updates the release notes of a given release.
2015-11-26 14:37:03 +05:30
```
PUT /projects/:id/repository/tags/:tag_name/release
```
Parameters:
2017-08-17 22:00:37 +05:30
- `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
2015-11-26 14:37:03 +05:30
- `tag_name` (required) - The name of a tag
2018-11-20 20:47:30 +05:30
Request body:
2015-11-26 14:37:03 +05:30
- `description` (required) - Release notes with markdown support
2018-11-20 20:47:30 +05:30
```json
{
"description": "Amazing release. Wow"
}
```
Response:
2015-11-26 14:37:03 +05:30
```json
{
"tag_name": "1.0.0",
"description": "Amazing release. Wow"
}
2016-06-02 11:05:42 +05:30
```