Creating a Protected Tag
Function
This API is used to create a tag protection rule.
URI
POST /v2/repositories/{repository_id}/protected-tags
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| repository_id | Yes | Integer | Explanation: Repository primary key ID. Constraints: Mandatory Range: 1–2147483647 Default value: None |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Explanation: User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token. Constraints: Mandatory Range: 1–100,000 characters. Default value: None |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | No | String | Explanation: Tag protection rule, which corresponds to tag name on the console. Constraints: None Range: 1–500 characters. Do not use spaces. Default value: None |
| create_access_level | No | Integer | Explanation: Permissions for creating protected tags. Constraints: None Range:
Default value: None |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| error | Error object | Explanation: Response error. |
| result | AddProtectTagResponse object | Explanation: Response result. |
| status | String | Explanation: Response status. Range:
|
| Parameter | Type | Description |
|---|---|---|
| code | String | Explanation: Error code. Range: See Error Codes. |
| message | String | Explanation: Error message. Range: Character string. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Explanation: Tag protection rule, which corresponds to tag name on the console. Range: 1–500 characters. |
| create_access_levels | CreateAccessLevels object | Explanation: Permissions for protected tags. |
| Parameter | Type | Description |
|---|---|---|
| access_level | Integer | Explanation: Permissions for creating protected tags. Range:
|
| access_level_description | String | Explanation: Permission description. Range:
|
Example Requests
POST https://{endpoint}/v2/repositories/{repository_id}/protected_tags
{
"name" : "test",
"create_access_level" : 40
} Example Responses
Status code: 200
OK
{
"result" : {
"name" : "test",
"create_access_levels" : {
"access_level" : 40,
"access_level_description" : "Maintainers"
}
},
"status" : "success"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
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.