创建合并请求。
接口说明
该接口需要确保当前企业已经在使用新版 MR,具体可看当前企业的合并请求页面是否已是新版本。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
当前API暂无授权信息透出。
请求语法
POST /api/v4/projects/{repositoryId}/merge_requests
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 | 
|---|---|---|---|---|
| organizationId | string | 是 | 企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】 | 6270e731cfea268afc21ccac | 
| accessToken | string | 否 | 个人访问令牌。 使用阿里云 AK+SK 或使用 STS 临时授权方式不需要传该字段 | f0b1e61db5961df5975a93f9129d2513 | 
| repositoryId | long | 是 | 代码库 ID | 2369234 | 
| body | object | 是 | 请求 Body | |
| sourceProjectId | long | 是 | 源代码库 ID | 2369234 | 
| sourceBranch | string | 是 | 源分支名称 | sourceBranch | 
| targetProjectId | long | 是 | 目标代码库 ID | 2369234 | 
| targetBranch | string | 是 | 目标分支名称 | targetBranch | 
| title | string | 是 | 合并请求标题 | 测试合并请求的标题 | 
| createFrom | string | 是 | 创建来源,固定取值为:WEB | WEB | 
| description | string | 否 | 合并请求描述信息 | 测试合并请求 | 
| reviewerIds | array | 否 | 评审人阿里云账号 ID 列表 | |
| string | 否 | 阿里云账号 ID | 1234567890 | |
| workItemIds | string | 否 | 关联工作项 ID,支持多个,以逗号隔开 | 722200214032b6b31e6f1434ab | 
返回参数
示例
正常返回示例
JSON格式
{
  "requestId": "F7B85D1B-D1C2-140F-A039-341859F130B9",
  "errorMessage": "\"\"",
  "errorCode": "SYSTEM_UNKNOWN_ERROR",
  "success": true,
  "result": {
    "mrBizId": "bca90244c4b749e0b109df52ac0eb570",
    "projectId": 2369234,
    "localId": 1,
    "createTime": "2023-06-02T03:41:22Z",
    "updateTime": "2023-06-02T03:41:22Z",
    "mrType": "CODE_REVIEW",
    "sourceProjectId": 2369234,
    "sourceBranch": "sourceBranch",
    "targetProjectId": 2369234,
    "targetBranch": "targetBranch",
    "title": "测试合并请求的标题",
    "description": "测试合并请求",
    "reviewers": [
      {
        "id": 7905,
        "name": "codeup",
        "username": "root-codeup",
        "state": "active",
        "avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
        "email": "username@example.com",
        "hasReviewed": false,
        "reviewOpinionStatus": "PASS"
      }
    ],
    "author": {
      "id": 19230,
      "name": "test-codeup",
      "username": "test-codeup-nickname",
      "state": "active",
      "avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
      "email": "username@example.com"
    },
    "subscribers": [
      {
        "id": 10092,
        "name": "test-codeup",
        "username": "root-test-codeup",
        "state": "active",
        "avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
        "email": "username@example.com"
      }
    ],
    "status": "UNDER_REVIEW",
    "createFrom": "WEB",
    "ahead": 2,
    "behind": 0,
    "detailUrl": "xxx",
    "webUrl": "https://codeup.aliyun.com/xxx/test/test\n",
    "allRequirementsPass": true,
    "supportMergeFastForwardOnly": true
  }
}错误码
访问错误中心查看更多错误码。
变更历史
| 变更时间 | 变更内容概要 | 操作 | 
|---|
暂无变更历史
