| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
| `name` | string | yes | The name of the label |
| `label_id` | integer or string | yes | The ID or title of a group's label. |
| `new_name` | string | no | The new name of the label |
| `color` | string | no | The color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords) |
| `description` | string | no | The description of the label. |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
| `label_id` | integer | yes (or `name`) | The id of the existing label |
| `name` | string | yes (or `label_id`) | The name of the existing label |
| `label_id` | integer or string | yes | The ID or title of a group's label. |
| `new_name` | string | yes if `color` is not provided | The new name of the label |
| `color` | string | yes if `new_name` is not provided | The color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords) |
| `description` | string | no | The new description of the label |
| `priority` | integer | no | The new priority of the label. Must be greater or equal than zero or `null` to remove the priority. |
```bash
curl --request PUT --data"name=documentation&new_name=docs&color=#8E44AD&description=Documentation"--header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/1/labels"
curl --request PUT --data"new_name=docs&color=#8E44AD&description=Documentation"--header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/1/labels/documentation"
```
Example response:
...
...
@@ -187,6 +223,8 @@ Example response:
}
```
NOTE: **Note:** An older endpoint `PUT /projects/:id/labels` with `name` or `label_id` in the params is still available, but deprecated.
## Promote a project label to a group label
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/25218) in GitLab 12.3.
desc'Update an existing label. At least one optional parameter is required.'do
detail'This feature was added in GitLab 11.8'
detail'This feature was added in GitLab 11.8 and deprecated in GitLab 12.4.'
successEntities::GroupLabel
end
paramsdo
requires:name,type: String,desc: 'The name of the label to be updated'
optional:new_name,type: String,desc: 'The new name of the label'
optional:color,type: String,desc: "The new color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the allowed CSS color names"
optional:description,type: String,desc: 'The new description of label'
at_least_one_of:new_name,:color,:description
optional:label_id,type: Integer,desc: 'The id of the label to be updated'
optional:name,type: String,desc: 'The name of the label to be updated'
use:group_label_update_params
exactly_one_of:label_id,:name
end
put':id/labels'do
update_label(user_group,Entities::GroupLabel)
end
desc'Delete an existing label'do
detail'This feature was added in GitLab 11.8'
detail'This feature was added in GitLab 11.8 and deprecated in GitLab 12.4.'
successEntities::GroupLabel
end
paramsdo
...
...
@@ -62,6 +73,29 @@ module API
delete':id/labels'do
delete_label(user_group)
end
desc'Update an existing label. At least one optional parameter is required.'do
detail'This feature was added in GitLab 12.4.'
successEntities::GroupLabel
end
paramsdo
requires:name,type: String,desc: 'The name or id of the label to be updated'
use:group_label_update_params
end
put':id/labels/:name'do
update_label(user_group,Entities::GroupLabel)
end
desc'Delete an existing label'do
detail'This feature was added in GitLab 12.4.'
successEntities::GroupLabel
end
paramsdo
requires:name,type: String,desc: 'The name or id of the label to be deleted'
optional:description,type: String,desc: 'The description of label to be created'
end
params:label_update_paramsdo
optional:new_name,type: String,desc: 'The new name of the label'
optional:color,type: String,desc: "The new color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the allowed CSS color names"
optional:description,type: String,desc: 'The new description of label'
end
params:project_label_update_paramsdo
use:label_update_params
optional:priority,type: Integer,desc: 'The priority of the label',allow_blank: true
desc'Update an existing label. At least one optional parameter is required.'do
detail'This feature was deprecated in GitLab 12.4.'
successEntities::ProjectLabel
end
paramsdo
optional:label_id,type: Integer,desc: 'The id of the label to be updated'
optional:name,type: String,desc: 'The name of the label to be updated'
optional:new_name,type: String,desc: 'The new name of the label'
optional:color,type: String,desc: "The new color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the allowed CSS color names"
optional:description,type: String,desc: 'The new description of label'
optional:priority,type: Integer,desc: 'The priority of the label',allow_blank: true