Use OpenAPI to query a single merge request (legacy).
Endpoint and authorization information
- Obtain the endpoint: Replace {domain} in the API request syntax.
- Obtain a personal access token.
|
Product |
Resource |
Required permission |
|
Code Management |
Merge request |
Read-only |
Request syntax
Request headers
|
Parameter |
Type |
Required |
Description |
Example value |
|
x-yunxiao-token |
string |
Yes |
Your personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example value |
|
repositoryId |
integer |
path |
Yes |
The repository ID or the full path URL-encoded. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
|
iid |
integer |
path |
Yes |
The merge request ID within the repository. |
1 |
Request example
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/mergeRequests/1' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example value |
| - |
object |
|
|
| acceptedRevision |
string |
The approved version. |
6da8c14b5a9102998148b7ea35f96507d5304f74 |
| ahead |
integer |
The number of commits the source branch is ahead of the target branch. |
1 |
| assignees |
array |
The list of reviewers. |
|
| - |
object |
|
|
| avatar |
string |
The profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
The email address. |
username@example.com |
|
| id |
integer |
The database primary key ID. This has no business meaning. |
1 |
| name |
string |
The user name. |
codeup-name |
| state |
string |
The user state. Valid values: active, blocked. Default: active. |
active |
| status |
string |
The reviewer's status. Valid values: approved, pending, comment. |
approved |
| userId |
string |
The Apsara DevOps user ID. Use this ID wherever a user ID appears in Codeup OpenAPI operations. |
62c795xxxb468af8 |
| username |
string |
The user name (login name). |
codeup-username |
| author |
object |
User information. |
|
| avatar |
string |
The profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
The email address. |
username@example.com |
|
| id |
integer |
The database primary key ID. This has no business meaning. |
1 |
| name |
string |
The user name. |
codeup-name |
| state |
string |
The user state. Valid values: active, blocked. Default: active. |
active |
| userId |
string |
The Apsara DevOps user ID. Use this ID wherever a user ID appears in Codeup OpenAPI operations. |
62c795xxxb468af8 |
| username |
string |
The user name (login name). |
codeup-username |
| behind |
integer |
The number of commits the target branch is ahead of the source branch. |
1 |
| createdAt |
string |
The creation time. |
2024-10-05T15:30:45Z |
| creationMethod |
string |
The creation method. Valid values: WEB, COMMAND. Default: WEB. |
WEB |
| description |
string |
The description of the merge request. |
mr description |
| detailUrl |
string |
The web address of the merge request details. |
https://example.com/example/example_demo/merge_requests/1 |
| downvotes |
integer |
The number of downvotes. |
1 |
| id |
integer |
The merge request ID. |
1 |
| iid |
integer |
The merge request ID within the repository. Indicates the sequence number of the merge request in the repository. |
1 |
| isUsePushBlock |
boolean |
Indicates whether push blocking is enabled. |
false |
| labels |
array[string] |
The list of labels. |
["BUG"] |
| mergeStatus |
string |
The merge status. Valid values: unchecked, can_be_merged, cannot_be_merged. |
can_be_merged |
| mergedRevision |
string |
Merged version. |
6da8c14b5a9102998148b7ea35f96507d5304f74 |
| nameWithNamespace |
string |
The full name of the repository, including the parent path. |
60de7a6852743a5162b5f957 / DemoRepo (spaces before and after the slash) |
| projectId |
integer |
The repository ID. |
2813489 |
| sourceBranch |
string |
The source branch. |
demo-branch |
| sourceProjectId |
integer |
The repository ID where the source branch resides. |
2813489 |
| sourceProjectName |
string |
The source repository name. |
Codeup-Demo |
| sourceType |
string |
The source type. Valid values: BRANCH, COMMIT. |
BRANCH |
| sshUrlToRepo |
string |
The SSH clone URL of the repository. |
git@example:example_org/example.git |
| state |
string |
The merge request state. Valid values: opened, closed, merged, accepted, reopened, locked. |
opened |
| subscribers |
array |
The list of subscribers. |
|
| - |
object |
User information. |
|
| avatar |
string |
The profile picture URL. |
https://example/example/w/100/h/100 |
|
string |
The email address. |
username@example.com |
|
| id |
integer |
The database primary key ID. This has no business meaning. |
1 |
| name |
string |
The user name. |
codeup-name |
| state |
string |
The user state. Valid values: active, blocked. Default: active. |
active |
| userId |
string |
The Apsara DevOps user ID. Use this ID wherever a user ID appears in Codeup OpenAPI operations. |
62c795xxxb468af8 |
| username |
string |
The user name (login name). |
codeup-username |
| supportMergeFFOnly |
boolean |
Indicates whether fast-forward-only merging is supported. |
true |
| targetBranch |
string |
The target branch. |
master |
| targetProjectId |
integer |
The repository ID where the target branch resides. |
2813489 |
| targetProjectName |
string |
The target repository name. |
Codeup-Demo |
| targetType |
string |
The target type. Valid values: BRANCH, COMMIT. |
BRANCH |
| title |
string |
The title of the merge request. |
mr title |
| updatedAt |
string |
The last update time. |
2024-10-05T15:30:45Z |
| upvotes |
integer |
The number of upvotes. |
1 |
| webUrl |
string |
The web address. |
https://example.com/example/example_demo/merge_requests/1 |
| workInProgress |
boolean |
Indicates whether the merge request is still under development. |
false |
Response example
{
"acceptedRevision": "6da8c14b5a9102998148b7ea35f96507d5304f74",
"ahead": 1,
"assignees": [
{
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"id": 1,
"name": "codeup-name",
"state": "active",
"status": "approved",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
}
],
"author": {
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"id": 1,
"name": "codeup-name",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
},
"behind": 1,
"createdAt": "2024-10-05T15:30:45Z",
"creationMethod": "WEB",
"description": "mr description",
"detailUrl": "https://example.com/example/example_demo/merge_requests/1",
"downvotes": 1,
"id": 1,
"iid": 1,
"isUsePushBlock": false,
"labels": ["BUG"],
"mergeStatus": "can_be_merged",
"mergedRevision": "6da8c14b5a9102998148b7ea35f96507d5304f74",
"nameWithNamespace": "60de7a6852743a5162b5f957 / DemoRepo (spaces before and after the slash)",
"projectId": 2813489,
"sourceBranch": "demo-branch",
"sourceProjectId": 2813489,
"sourceProjectName": "Codeup-Demo",
"sourceType": "BRANCH",
"sshUrlToRepo": "git@example:example_org/example.git",
"state": "opened",
"subscribers": [
{
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"id": 1,
"name": "codeup-name",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
}
],
"supportMergeFFOnly": true,
"targetBranch": "master",
"targetProjectId": 2813489,
"targetProjectName": "Codeup-Demo",
"targetType": "BRANCH",
"title": "mr title",
"updatedAt": "2024-10-05T15:30:45Z",
"upvotes": 1,
"webUrl": "https://example.com/example/example_demo/merge_requests/1",
"workInProgress": false
}
Error codes
For error codes related to this API, see the Error Code Center.