文档

CreateBranch - 创建分支

创建代码库分支。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求语法

POST /repository/{repositoryId}/branches

请求参数

名称类型必填描述示例值
organizationIdstring

企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】

60de7a6852743a5162b5f957
accessTokenstring

个人访问令牌。 使用阿里云 AK+SK 或使用 STS 临时授权方式不需要传该字段

0cf2c8458ac44d9481aab2dd6ec10596v3
repositoryIdstring

代码库 ID

2334815
bodyobject

请求 Body

branchNamestring

分支名称

createBranch
refstring

来源分支,指从某个分支创建新分支。

master

返回参数

名称类型描述示例值
object

Schema of Response

requestIdstring

请求 ID

F7B85D1B-D1C2-140F-A039-341859F130B9
errorMessagestring

错误信息

""
errorCodestring

错误码

SYSTEM_UNKNOWN_ERROR
successboolean

调用是否成功

true
resultobject

返回结果

namestring

分支名称

createBranch
protectedboolean

是否是保护分支

false
commitobject

分支最近一次提交信息

idstring

提交 ID

ff4fb5ac6d1f44f452654336d2dba468ae6c8d04
shortIdstring

简短的提交 ID

ff4fb5ac
titlestring

提交标题,提交的第一行内容

创建代码库分支
authorNamestring

作者姓名

阿里云云效
authorEmailstring

作者邮箱

username@example.com
createdAtstring

创建时间

2022-03-18 10:00:00
messagestring

提交内容

create branch
authoredDatestring

作者提交时间

2022-03-18 09:00:00
committedDatestring

提交人的提交时间

2022-03-18 10:00:00
committerEmailstring

提交人的邮箱

username@example.com
committerNamestring

提交人的姓名

阿里云云效committer
parentIdsarray

父提交 ID 列表

string

父提交 ID

34d2c47c7ce46a5c4639c5ffe208a66dda975a05

示例

正常返回示例

JSON格式

{
  "requestId": "F7B85D1B-D1C2-140F-A039-341859F130B9",
  "errorMessage": "\"\"",
  "errorCode": "SYSTEM_UNKNOWN_ERROR",
  "success": true,
  "result": {
    "name": "createBranch",
    "protected": false,
    "commit": {
      "id": "ff4fb5ac6d1f44f452654336d2dba468ae6c8d04",
      "shortId": "ff4fb5ac",
      "title": "创建代码库分支",
      "authorName": "阿里云云效",
      "authorEmail": "username@example.com",
      "createdAt": "2022-03-18 10:00:00",
      "message": "create branch",
      "authoredDate": "2022-03-18 09:00:00",
      "committedDate": "2022-03-18 10:00:00",
      "committerEmail": "username@example.com",
      "committerName": "阿里云云效committer",
      "parentIds": [
        "34d2c47c7ce46a5c4639c5ffe208a66dda975a05"
      ]
    }
  }
}

错误码

HTTP status code错误码错误信息描述
403Forbidden.AccessDeniedThe user is not authorized to perform the operation.用户无权限执行相关操作
403Forbidden.UserNotInCurrentOrganizationThe user is not in the organization and is not authorized to perform the operation.当前用户不在该企业中,无权进行操作。

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史
  • 本页导读 (0)
文档反馈