查询代码库保护分支列表。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
当前API暂无授权信息透出。
请求语法
GET /repository/{repositoryId}/protect_branches
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
organizationId | string | 是 | 企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】 | 60de7a6852743a5162b5f957 |
accessToken | string | 否 | 个人访问令牌。 使用阿里云 AK+SK 或使用 STS 临时授权方式不需要传该字段 | f0b1e61db5961df5975a93f9129d2513 |
repositoryId | long | 是 | 代码库 ID | 2813489 |
返回参数
示例
正常返回示例
JSON
格式
{
"requestId": "313A1BF6-63B7-52D4-A098-952221A65254",
"errorMessage": "\"\"",
"errorCode": "SYSTEM_UNKNOWN_ERROR",
"success": true,
"result": [
{
"id": 19285,
"branch": "protectedBranch",
"createdAt": "2022-03-18 14:24:54",
"updatedAt": "2022-03-18 14:24:54",
"allowPushRoles": [
0
],
"allowPushUserIds": [
19238
],
"allowPushUsers": [
{
"id": 19238,
"name": "阿里云云效",
"username": "codeup-test",
"email": "username@example.com",
"avatar": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100"
}
],
"allowMergeRoles": [
0
],
"allowMergeUserIds": [
19238
],
"allowMergeUsers": [
{
"id": 19238,
"name": "阿里云云效",
"username": "codeup-test",
"email": "username@example.com",
"avatar": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100"
}
],
"mergeRequestSetting": {
"isRequired": true,
"mrMode": "general",
"isAllowSelfApproval": true,
"isRequireDiscussionProcessed": true,
"isResetApprovalWhenNewPush": false,
"minimumApproval": 1,
"allowMergeRequestRoles": [
0
],
"defaultAssignees": [
{
"id": 19238,
"username": "codeup-test",
"name": "阿里云云效",
"email": "username@example.com",
"avatar": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100"
}
],
"whiteList": "**.java"
},
"testSettingDTO": {
"isRequired": false,
"codeGuidelinesDetection": {
"enabled": false,
"message": "test_code_guide_lines"
},
"sensitiveInfoDetection": {
"enabled": false,
"message": "test_code_sensitive_info"
},
"checkTaskQualityConfig": {
"enabled": false,
"bizNo": "123456",
"taskName": "biz-task-quality",
"message": "test_task_quality"
},
"checkConfig": {
"checkItems": [
{
"name": "测试流水线",
"isRequired": false
}
]
}
},
"matches": [
"[\"pb\"]"
]
}
]
}
错误码
HTTP status code | 错误码 | 错误信息 | 描述 |
---|---|---|---|
403 | Forbidden.AccessDenied | The user is not authorized to perform the operation. | 用户无权限执行相关操作 |
403 | Forbidden.UserNotInCurrentOrganization | The user is not in the organization and is not authorized to perform the operation. | 当前用户不在该企业中,无权进行操作。 |
访问错误中心查看更多错误码。
变更历史
变更时间 | 变更内容概要 | 操作 |
---|---|---|
2023-07-24 | OpenAPI 错误码发生变更、OpenAPI 返回结构发生变更 | 查看变更详情 |