CreateMergeRequest
Creates a merge request.
Operation description
This operation requires the current organization to use the new version of merge requests. You can verify this by checking if the merge request page of the organization displays the new version.
Try it now
Test
RAM authorization
Request syntax
POST /api/v4/projects/{repositoryId}/merge_requests HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| repositoryId |
integer |
Yes |
The repository ID. |
2369234 |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| organizationId |
string |
Yes |
The organization ID. It is a string that can be obtained from the Yunxiao access URL, such as https://devops.aliyun.com/organization/[OrganizationId]. |
6270e731cfea268afc21ccac |
| accessToken |
string |
No |
The personal access token. This parameter is not required if you use an Alibaba Cloud AccessKey pair or Security Token Service (STS) for temporary authorization. |
f0b1e61db5961df5975a93f9129d2513 |
| body |
object |
Yes |
The request body. |
|
| sourceProjectId |
integer |
Yes |
The source repository ID. |
2369234 |
| sourceBranch |
string |
Yes |
The name of the source branch. |
sourceBranch |
| targetProjectId |
integer |
Yes |
The target repository ID. |
2369234 |
| targetBranch |
string |
Yes |
The name of the target branch. |
targetBranch |
| title |
string |
Yes |
The title of the merge request. |
Test merge request title |
| createFrom |
string |
Yes |
The creation source. Valid value: WEB. |
WEB |
| description |
string |
No |
The description of the merge request. |
Test merge request |
| reviewerIds |
array |
No |
The list of Alibaba Cloud account IDs of the reviewers. |
|
|
string |
No |
The Alibaba Cloud account ID. |
1234567890 |
|
| workItemIds |
string |
No |
The IDs of the associated work items. Multiple IDs are supported and must be separated by commas. |
722200214032b6b31e6f1434ab |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
The request ID. |
F7B85D1B-D1C2-140F-A039-341859F130B9 |
| errorMessage |
string |
The error message. |
"" |
| errorCode |
string |
The error code. |
SYSTEM_UNKNOWN_ERROR |
| success |
boolean |
Indicates whether the call was successful. |
true |
| result |
object |
The returned result. |
|
| mrBizId |
string |
The unique ID of the merge request. |
bca90244c4b749e0b109df52ac0eb570 |
| projectId |
integer |
The repository ID. |
2369234 |
| localId |
integer |
The local ID of the merge request, which indicates the sequence number of the merge request in the repository. |
1 |
| createTime |
string |
The creation time. |
2023-06-02T03:41:22Z |
| updateTime |
string |
The update time. |
2023-06-02T03:41:22Z |
| mrType |
string |
The type of the merge request. Valid value: CODE_REVIEW. |
CODE_REVIEW |
| sourceProjectId |
integer |
The ID of the repository where the source branch resides. |
2369234 |
| sourceBranch |
string |
The name of the source branch. |
sourceBranch |
| targetProjectId |
integer |
The ID of the repository where the target branch resides. |
2369234 |
| targetBranch |
string |
The name of the target branch. |
targetBranch |
| title |
string |
The title of the merge request. |
Test merge request title |
| description |
string |
The description of the merge request. |
Test merge request |
| reviewers |
array<object> |
The list of reviewers. |
|
|
object |
The reviewer information. |
||
| id |
integer |
The Codeup user ID. |
7905 |
| name |
string |
The name of the user. |
codeup |
| username |
string |
The organization logon name. |
root-codeup |
| state |
string |
The user status. Valid values:
|
active |
| avatarUrl |
string |
The URL of the reviewer's avatar. |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100 |
|
string |
The email address. |
username@example.com |
|
| hasReviewed |
boolean |
Indicates whether the reviewer has completed the review. |
false |
| reviewOpinionStatus |
string |
The review opinion. Valid values:
|
PASS |
| author |
object |
The creator information. |
|
| id |
integer |
The Codeup user ID. |
19230 |
| name |
string |
The name of the user. |
test-codeup |
| username |
string |
The user logon name. |
test-codeup-nickname |
| state |
string |
The user status. Valid values:
|
active |
| avatarUrl |
string |
The URL of the avatar. |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100 |
|
string |
The email address of the user. |
username@example.com |
|
| subscribers |
array<object> |
The list of subscribers. |
|
|
object |
The subscriber information. |
||
| id |
integer |
The Codeup user ID. |
10092 |
| name |
string |
The name of the user. |
test-codeup |
| username |
string |
The user logon name. |
root-test-codeup |
| state |
string |
The user status. Valid values:
|
active |
| avatarUrl |
string |
The URL of the avatar. |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100 |
|
string |
The email address of the user. |
username@example.com |
|
| status |
string |
The status of the merge request. Valid values:
|
UNDER_REVIEW |
| createFrom |
string |
The creation source. Valid value: WEB. |
WEB |
| ahead |
integer |
The number of commits that the source branch is ahead of the target branch. |
2 |
| behind |
integer |
The number of commits that the target branch is behind the source branch. |
0 |
| detailUrl |
string |
The URL of the details page. |
https://example.com/org/demo-repo/change/1 |
| webUrl |
string |
The web URL of the merge request. |
https://codeup.aliyun.com/xxx/test/test |
| allRequirementsPass |
boolean |
Indicates whether all checkpoints are passed. |
true |
| supportMergeFastForwardOnly |
boolean |
Indicates whether the fast-forward-only merge method is supported. |
true |
Examples
Success response
JSON format
{
"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": "Title of the test merge request",
"description": "Test merge request",
"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
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.