ListProtectedBranches - List protected branches
Retrieves a list of protected branches. Pagination is not supported.
|
Applicable editions |
Central edition, Region edition |
Endpoint and authorization information
- Obtain the endpoint: Replace {domain} in the API request syntax.
- Obtain a personal access token.
- Obtain organizationId: Required only for the Central edition. Go to the Basic Information page in the Organization Management console to obtain your organization ID.
|
Product |
Resource |
Required permission |
|
Code management |
Protected branches |
Read-only |
Request syntax
Central edition
GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/protectedBranches
Region edition
GET https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/protectedBranches
Request headers
|
Parameter |
Type |
Required |
Description |
Example value |
|
x-yunxiao-token |
string |
Yes |
Personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example value |
|
organizationId |
string |
path |
|
Organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
Repository ID or URL-encoded full path. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
Request examples
Central edition
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/protectedBranches' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Region edition
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/repositories/2813489or60de7a6852743a5162b5f957%2FDemoRepo/protectedBranches' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example value |
| - |
array |
|
|
| - |
object |
|
|
| allowMergeRoles |
array[integer] |
List of roles allowed to merge: 40 – administrator, 30 – developer. |
[40, 30] |
| allowMergeUserIds |
array[string] |
List of user IDs allowed to merge. |
["62c795xxxb468af8"] |
| allowMergeUsers |
array |
List of users allowed to merge. |
|
| - |
object |
|
|
| avatarUrl |
string |
Profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
Email address. |
username@example.com |
|
| id |
integer |
Database primary key ID. This ID has no business meaning. |
1 |
| name |
string |
User name. |
codeup-demo |
| userId |
string |
Apsara DevOps user ID. Use this ID whenever a user ID is required in Codeup OpenAPI. |
62c795xxxb468af8 |
| username |
string |
Username (logon name). |
codeup-username |
| allowPushRoles |
array[integer] |
List of roles allowed to push: 40 – administrator, 30 – developer. |
[40, 30] |
| allowPushUserIds |
array[string] |
List of user IDs allowed to push. |
["62c795xxxb468af8"] |
| allowPushUsers |
array |
List of users allowed to push. |
|
| - |
object |
|
|
| avatarUrl |
string |
Profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
Email address. |
username@example.com |
|
| id |
integer |
Database primary key ID. This ID has no business meaning. |
1 |
| name |
string |
User name. |
codeup-demo |
| userId |
string |
Apsara DevOps user ID. Use this ID whenever a user ID is required in Codeup OpenAPI. |
62c795xxxb468af8 |
| username |
string |
Username (logon name). |
codeup-username |
| branch |
string |
Branch name. |
master |
| createdAt |
string |
Creation time. |
2024-10-05T15:30:45Z |
| id |
integer |
Protected branch rule ID. |
1 |
| matches |
array[string] |
List of matching branches. |
["master"] |
| mergeRequestSetting |
object |
|
|
| allowMergeRequestRoles |
array[integer] |
List of roles allowed to create merge requests. |
[40, 30] |
| defaultAssignees |
array |
List of default reviewers. |
|
| - |
object |
|
|
| avatarUrl |
string |
Profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
Email address. |
username@example.com |
|
| id |
integer |
Database primary key ID. This ID has no business meaning. |
1 |
| name |
string |
User name. |
codeup-demo |
| userId |
string |
Apsara DevOps user ID. Use this ID whenever a user ID is required in Codeup OpenAPI. |
62c795xxxb468af8 |
| username |
string |
Username (logon name). |
codeup-username |
| isAllowSelfApproval |
boolean |
Indicates whether the creator can approve their own code review. |
false |
| isAllowSourceBranchPushUserApproval |
boolean |
Indicates whether the source branch committer can approve the merge request. |
false |
| isRequireDiscussionProcessed |
boolean |
Indicates whether all reviews must be resolved. |
true |
| isRequired |
boolean |
Indicates whether the setting is enabled. |
true |
| isResetApprovalWhenNewPush |
boolean |
Indicates whether the review status resets when new commits are pushed. |
true |
| minimumApproval |
integer |
Minimum number of approvals required. Applies only in general mode. |
1 |
| mrMode |
string |
Review mode: General or CodeOwner. |
general |
| whiteList |
string |
File review whitelist. Enter file paths separated by newlines. Use English-format wildcard characters. |
*.java |
| testSetting |
object |
|
|
| checkCheckRunConfig |
object |
Run check. |
|
| checkRunCheckItems |
array |
List of configuration items. |
|
| - |
object |
|
|
| id |
string |
Writer ID. |
62c795xxxb468af8 |
| name |
string |
Name of the check run. |
default-test-check-run-name |
| required |
boolean |
Indicates whether this is a blocking check. |
true |
| type |
string |
Writer type: User. |
User |
| checkCommitStatusConfig |
object |
Commit status. |
|
| commitStatusCheckItems |
array |
List of configuration items. |
|
| - |
object |
|
|
| context |
string |
Name of the third-party commit status. Used as the matching identifier for blocking checks. |
default-context |
| required |
boolean |
Indicates whether this is a blocking check. |
true |
| checkConfig |
object |
Pipeline check. |
|
| checkItems |
array |
List of configuration items. |
|
| - |
object |
|
|
| isRequired |
boolean |
Indicates whether this is a blocking check. |
true |
| pipelineId |
integer |
Pipeline ID. |
1880578 |
| pipelineName |
string |
Pipeline name. |
codeup-demo test code detection |
| checkTaskQualityConfig |
object |
Code detection task. |
|
| bizNo |
string |
Detection task pipeline number. |
202207192301340000110700070550024 |
| enabled |
boolean |
Indicates whether the setting is enabled. |
true |
| message |
string |
Description. |
Test code detection |
| taskName |
string |
Detection task name. |
codeup-demo code detection |
| isRequired |
boolean |
Indicates whether the setting is enabled. |
true |
| updatedAt |
string |
Update time. |
2024-10-05T15:30:45Z |
Response example
[
{
"allowMergeRoles": [40, 30],
"allowMergeUserIds": ["62c795xxxb468af8"],
"allowMergeUsers": [
{
"avatarUrl": "https://example/example/w/100/h/100",
"email": "username@example.com",
"id": 1,
"name": "codeup-demo",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
}
],
"allowPushRoles": [40, 30],
"allowPushUserIds": ["62c795xxxb468af8"],
"allowPushUsers": [
{
"avatarUrl": "https://example/example/w/100/h/100",
"email": "username@example.com",
"id": 1,
"name": "codeup-demo",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
}
],
"branch": "master",
"createdAt": "2024-10-05T15:30:45Z",
"id": 1,
"matches": ["master"],
"mergeRequestSetting": {
"allowMergeRequestRoles": [40, 30],
"defaultAssignees": [
{
"avatarUrl": "https://example/example/w/100/h/100",
"email": "username@example.com",
"id": 1,
"name": "codeup-demo",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
}
],
"isAllowSelfApproval": false,
"isAllowSourceBranchPushUserApproval": false,
"isRequireDiscussionProcessed": true,
"isRequired": true,
"isResetApprovalWhenNewPush": true,
"minimumApproval": 1,
"mrMode": "general",
"whiteList": "*.java"
},
"testSetting": {
"checkCheckRunConfig": {
"checkRunCheckItems": [
{
"id": "62c795xxxb468af8",
"name": "default-test-check-run-name",
"required": true,
"type": "User"
}
]
},
"checkCommitStatusConfig": {
"commitStatusCheckItems": [
{
"context": "default-context",
"required": true
}
]
},
"checkConfig": {
"checkItems": [
{
"isRequired": true,
"pipelineId": 1880578,
"pipelineName": "codeup-demo test code detection"
}
]
},
"checkTaskQualityConfig": {
"bizNo": "202207192301340000110700070550024",
"enabled": true,
"message": "Test code detection",
"taskName": "codeup-demo code detection"
},
"isRequired": true
},
"updatedAt": "2024-10-05T15:30:45Z"
}
]
Error codes
For more information, see Error Code Center for API-related error codes.