Obtaining a Protected Tag
Function
This API is used to obtain a protected tag.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET https://{hostURL}/v4/repositories/{repository_id}/protected-tag
| 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 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| tag_name | Yes | String | Definition: Protected tag name or wildcard list. Constraints: N/A. Value range: N/A. Default value: N/A. Default value: N/A |
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. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Protection tag ID. Value range: 1–2147483647 |
| name | String | Definition: Branch name or wildcard. Value range: N/A. |
| actions | Array of RepositoryProtectedActionDto objects | Definition: Event list. Value range: N/A. |
| Parameter | Type | Description |
|---|---|---|
| action | String | Definition: Event name. Value range: N/A. |
| enable | Boolean | Definition: Whether to enable. Value range: |
| users | Array of RepositoryUserDto objects | Definition: Whitelisted user list. Value range: N/A. |
| user_teams | Array of UserTeamBasicDto objects | Definition: Whitelisted user group list. Value range: N/A. |
| roles | Array of BasicRoleDto objects | Definition: Whitelisted role list. Value range: N/A. |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition User ID. Value range: 1~2147483647 |
| name | String | Definition Username. |
| username | String | Definition Username. |
| state | String | Definition: User status Value range: Enumeration values: |
| avatar_url | String | Definition: Profile picture URL. Value range: N/A. |
| nick_name | String | Definition: User alias. Value range: N/A. |
| tenant_name | String | Definition: Tenant name. Value range: N/A. |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: User group ID. Value range: 1–2147483647 |
| name | String | Definition: User group name. Value range: N/A. |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Role ID. Value range: 1–2147483647 |
| name | String | Definition: Role name. Value range: N/A. |
| related_role_id | String | Definition: Associated role ID. Value range: N/A. |
| chinese_name | String | Definition: Role name in Chinese. Value range: N/A. |
Example Requests
None
Example Responses
Status code: 200
Protected tag in a repository.
{
"id" : 124612,
"name" : "ttt6",
"actions" : [ {
"action" : "create",
"enable" : true,
"users" : [ {
"id" : 9124,
"name" : "user1",
"username" : "c369c68f1ff84679b5a8ed904d8bff1c",
"state" : "active",
"avatar_url" : "",
"nick_name" : "name",
"tenant_name" : "t1"
} ],
"user_teams" : [ {
"id" : 251,
"name" : "team-2"
} ],
"roles" : [ {
"id" : 23836595,
"name" : "Administrator",
"related_role_id" : "7a96af96176e4f728f571b8af8551dec",
"chinese_name" : "Project administrator"
} ]
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Protected tag in a repository. |
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.