GetChangeRequest - Query a merge request
Use OpenAPI to query the details of a merge request.
|
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 your organization ID. 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 |
Merge request |
Read-only |
Request syntax
Central edition
GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/changeRequests/{localId}
Region edition
GET https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/changeRequests/{localId}
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 |
|
localId |
integer |
path |
Yes |
Local ID indicating the sequence number of the merge request in the repository. |
1 |
Request examples
Central edition
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/changeRequests/1' \
-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/2813489%20or%2060de7a6852743a5162b5f957%2FDemoRepo/changeRequests/1' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example value |
| - |
object |
|
|
| ahead |
integer |
Number of commits by which the source branch is ahead of the target branch. |
1 |
| allRequirementsPass |
boolean |
Indicates whether all required checks have passed. |
true |
| author |
object |
User information. |
|
| avatar |
string |
Profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
User email address. |
username@example.com |
|
| name |
string |
User name. |
codeup-name |
| state |
string |
User status: active – available; blocked – temporarily unavailable. |
active |
| userId |
string |
The user ID for Apsara DevOps. |
62c795xxxb468af8 |
| username |
string |
User logon name. |
codeup-username |
| behind |
integer |
Number of commits by which the target branch is ahead of the source branch. |
1 |
| canRevertOrCherryPick |
boolean |
Indicates whether revert or cherry-pick is allowed. |
true |
| conflictCheckStatus |
string |
Conflict detection status: CHECKING – checking in progress; HAS_CONFLICT – conflicts detected; NO_CONFLICT – no conflicts; FAILED – check failed. |
NO_CONFLICT |
| createFrom |
string |
Creation source: WEB – created via web UI; COMMAND_LINE – created via command line. |
WEB |
| createTime |
string |
Creation time. |
2024-10-05T15:30:45Z |
| description |
string |
Description. |
mr description |
| detailUrl |
string |
URL to the merge request details page. |
https://example.com/example/example_demo/change/1 |
| hasReverted |
boolean |
Indicates whether the merge request has been reverted. |
false |
| localId |
integer |
Local ID. |
1 |
| mergedRevision |
string |
Merge revision (commit ID). This field has a value only if the merge request is merged. |
6da8c14b5a9102998148b7ea35f96507d5304f74 |
| mrType |
string |
Merge request type: CODE_REVIEW – code review; REF_REVIEW – branch or tag review. |
CODE_REVIEW |
| projectId |
integer |
Repository ID. |
2813489 |
| reviewers |
array |
List of reviewers. |
|
| - |
object |
|
|
| avatar |
string |
Profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
User email address. |
username@example.com |
|
| hasCommented |
boolean |
Indicates whether the reviewer has commented. |
true |
| hasReviewed |
boolean |
Indicates whether the reviewer has reviewed. |
true |
| name |
string |
User name. |
codeup-name |
| reviewOpinionStatus |
string |
Review opinion: PASS – approved; NOT_PASS – not approved. |
PASS |
| reviewTime |
string |
Review time. |
2024-10-05T15:30:45Z |
| state |
string |
User status: active – available; blocked – temporarily unavailable. |
active |
| userId |
string |
Apsara DevOps user ID. |
62c795xxxb468af8 |
| username |
string |
User logon name. |
codeup-username |
| sourceBranch |
string |
Source branch. |
demo-branch |
| sourceProjectId |
integer |
Source repository ID. |
2813489 |
| status |
string |
Merge request status: UNDER_DEV – under development; UNDER_REVIEW – under review; TO_BE_MERGED – ready to merge; CLOSED – closed; MERGED – merged. |
UNDER_REVIEW |
| subscribers |
array |
List of subscribers. |
|
| - |
object |
User information. |
|
| avatar |
string |
Profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
User email address. |
username@example.com |
|
| name |
string |
User name. |
codeup-name |
| state |
string |
User status: active – available; blocked – temporarily unavailable. |
active |
| userId |
string |
Apsara DevOps user ID. |
62c795xxxb468af8 |
| username |
string |
User logon name. |
codeup-username |
| supportMergeFastForwardOnly |
boolean |
Indicates whether fast-forward-only merge is supported. |
true |
| targetBranch |
string |
Target branch. |
master |
| targetProjectId |
integer |
Destination repository ID. |
2813489 |
| targetProjectNameWithNamespace |
string |
Destination repository name including full parent path. |
60de7a6852743a5162b5f957 / DemoRepo (spaces around the slash) |
| targetProjectPathWithNamespace |
string |
Destination repository path including full parent path. |
60de7a6852743a5162b5f957/DemoRepo |
| title |
string |
Title. |
mr title |
| totalCommentCount |
integer |
Total number of comments. |
1 |
| unResolvedCommentCount |
integer |
Number of unresolved comments. |
1 |
| updateTime |
string |
Update time. |
2024-10-05T15:30:45Z |
| webUrl |
string |
Web page URL. |
https://example.com/example/example_demo/change/1 |
Response example
{
"ahead": 1,
"allRequirementsPass": true,
"author": {
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"name": "codeup-name",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
},
"behind": 1,
"canRevertOrCherryPick": true,
"conflictCheckStatus": "NO_CONFLICT",
"createFrom": "WEB",
"createTime": "2024-10-05T15:30:45Z",
"description": "mr description",
"detailUrl": "https://example.com/example/example_demo/change/1",
"hasReverted": false,
"localId": 1,
"mergedRevision": "6da8c14b5a9102998148b7ea35f96507d5304f74",
"mrType": "CODE_REVIEW",
"projectId": 2813489,
"reviewers": [
{
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"hasCommented": true,
"hasReviewed": true,
"name": "codeup-name",
"reviewOpinionStatus": "PASS",
"reviewTime": "2024-10-05T15:30:45Z",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
}
],
"sourceBranch": "demo-branch",
"sourceProjectId": 2813489,
"status": "UNDER_REVIEW",
"subscribers": [
{
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"name": "codeup-name",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
}
],
"supportMergeFastForwardOnly": true,
"targetBranch": "master",
"targetProjectId": 2813489,
"targetProjectNameWithNamespace": "60de7a6852743a5162b5f957 / DemoRepo (spaces around the slash)",
"targetProjectPathWithNamespace": "60de7a6852743a5162b5f957/DemoRepo",
"title": "mr title",
"totalCommentCount": 1,
"unResolvedCommentCount": 1,
"updateTime": "2024-10-05T15:30:45Z",
"webUrl": "https://example.com/example/example_demo/change/1"
}
Error codes
For more information about API-related error codes, see the Error Code Center.