Creating a Repository Tag
Function
This API is used to create a repository tag.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
POST https://{hostURL}/v4/repositories/{repository_id}/labels
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| repository_id | Yes | Integer | Definition You can query the project list to obtain the repository ID by calling the API used to query user's all repositories. Constraints N/A. Value range: 1~2147483647 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. Obtain a token by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Constraints Mandatory. Range 1–100,000 characters. Default Value N/A. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition: Tag name. Constraints: N/A. Value range: N/A. Default value: N/A. |
| color | No | String | Definition: Tag color, which is provided in a 6-character hexadecimal format starting with sign (#) (for example, #FFAABB). Constraints: N/A. Value range: Regular expression: ^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$ Default value: N/A. |
| description | No | String | Definition: Description. Constraints: N/A. Value range: N/A. Default value: N/A. |
| expires_at | No | String | Definition: Expiration time. Constraints: N/A. Value range: N/A. Default value: N/A. |
Response Parameters
Status code: 201
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Tag ID. Value range: 1–2147483647 Value range: 1~2147483647 |
| name | String | Definition: Tag name. Value range: N/A. |
| color | String | Definition: Tag color, which is provided in a 6-character hexadecimal format starting with sign (#) (for example, #FFAABB). Value range: Regular expression: ^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$ |
| description | String | Definition: Description. Value range: N/A. |
| text_color | String | Definition: Font color, which is provided in a 6-digit hexadecimal format starting with sign (#) (for example, #FFAABB). Value range: Regular expression: ^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$ |
| expires_at | String | Definition: Expiration time. Value range: N/A. |
| is_expired | Boolean | Definition: Whether it is invalid. Value range: N/A. |
| open_merge_requests_count | Integer | Definition: Number of enabled MRs to be associated. Constraints: This field is returned by the MR repository. Value range: 0–2147483647 Value range: 0~2147483647 |
| open_change_request_count | Integer | Definition: Number of enabled CRs to be associated. Constraints: This field is returned by the CR repository. Value range: 0–2147483647 Value range: 0~2147483647 |
| priority | Integer | Definition: Priority. Value range: N/A. Value range: 0~30 |
| is_repository_label | Boolean | Definition: Whether it is a repository tag. Value range: N/A. |
Example Requests
POST /v4/repositories/123/labels
{
"name" : "test",
"color" : "#6BC950",
"description" : "test1",
"expires_at" : "2025-6-18"
} Example Responses
Status code: 201
Repository tag.
{
"id" : 76,
"name" : "test",
"color" : "#6BC950",
"description" : "test1",
"text_color" : "#FFFFFF",
"expires_at" : "2030-05-16",
"is_expired" : false,
"open_merge_requests_count" : 0,
"priority" : 0,
"is_repository_label" : true
} Status Codes
| Status Code | Description |
|---|---|
| 201 | Repository tag. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.