Obtaining the Project MR List
Function
This API is used to obtain the project MR list.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
|
Action |
Access Level |
Resource Type (*: required) |
Condition Key |
Alias |
Dependencies |
|---|---|---|---|---|---|
|
codeartsrepo:repository:getMergeRequest |
Read |
- |
- |
- |
- |
URI
GET https://{hostURL}/v4/projects/{project_id}/merge-requests
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition You can obtain the unique project identifier, 32-character project UUID, by calling the API used to query the project list. Range String length: 32 characters. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
offset |
No |
Integer |
Definition Offset, which starts from 0. Value range: 0~2147483647 Default value: 0 |
|
limit |
No |
Integer |
Definition Number of returned records. Value range: 1~100 Default value: 20 |
|
state |
No |
String |
Definition Returns MRs of the specified statuses. Constraints
Default value: all Enumeration values:
|
|
order_by |
No |
String |
Definition Sorting method. Range
Default value: created_at Enumeration values:
|
|
sort |
No |
String |
Definition Sorting method. Constraints
Default value: desc Enumeration values:
|
|
author_id |
No |
String |
Definition Returns the MR created by the users with the specified ID. Multiple IDs are separated by commas (,). The union of MRs that meet the conditions is returned. |
|
source_branch |
No |
String |
Definition Returns the MR of the specified source branch. |
|
target_branch |
No |
String |
Definition Returns the MR of the specified target branch. |
|
search |
No |
String |
Definition MR keyword search. Return MRs whose titles or descriptions contain the keyword. |
|
source_repository_id |
No |
Integer |
Definition Query the specified source repository data. |
|
only_count |
No |
Boolean |
Definition Whether to only return the number of MRs. Range
Default value: false |
|
labels |
No |
String |
Definition Query MRs that contain the specified labels. Value range: 1~2000 |
|
topic |
No |
String |
Definition MR subject. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token. Obtain one by calling the IAM API Obtaining a User Token. The value of X-Subject-Token in the response header is a token. Constraints N/A Range 1–100,000 characters. Default Value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
X-Total |
String |
Definition Total number of MRs in a project. |
|
Parameter |
Type |
Description |
|---|---|---|
|
[items] |
Array of MergeRequestListBasicDto objects |
MR basic information |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition MR ID. |
|
iid |
Integer |
Definition No. of the MR located in the current repository. |
|
title |
String |
Definition MR title. |
|
source_branch |
String |
Definition MR source branch. |
|
target_branch |
String |
Definition MR target branch. |
|
state |
String |
Definition MR status. |
|
created_at |
String |
Definition Time when an MR was created. |
|
updated_at |
String |
Definition MR update time. |
|
source_repository_id |
Integer |
Definition MR source repository ID. |
|
review_mode |
String |
Definition MR review mode. |
|
author |
UserBasicDto object |
Definition MR author. |
|
closed_at |
String |
Definition Time when an MR was closed. |
|
closed_by |
UserBasicDto object |
Definition MR closer. |
|
merged_at |
String |
Definition Time when an MR was merged. |
|
merged_by |
UserBasicDto object |
Definition MR merger. |
|
pipeline_status |
String |
Definition MR pipeline status. |
|
codequality_status |
String |
Definition MR code quality status. |
|
pipeline_status_with_code_quality |
String |
Definition MR pipeline status. |
|
notes |
Integer |
Definition MR review comment. |
|
source_repository |
ProjectSimpleDto object |
Definition MR source repository information. |
|
target_repository |
ProjectSimpleDto object |
Definition MR target repository information. |
|
web_url |
String |
Definition MR URL. |
|
added_lines |
Integer |
Definition Lines of code added in an MR. |
|
removed_lines |
Integer |
Definition Lines of code deleted in an MR. |
|
merge_request_type |
String |
Definition MR review mode. |
|
source_git_url |
String |
Definition MR Git address. |
|
labels |
Array of Map<String,Object> objects |
Definition MR label. |
|
score |
Integer |
Definition MR score. |
|
min_merged_score |
Integer |
Definition Minimum merge score of an MR. |
|
source_product_id |
String |
Definition MR source project ID. |
|
target_product_id |
String |
Definition MR target project ID. |
|
product_name |
String |
Definition MR project name. |
|
notes_count |
NotesCountDto object |
Definition Number of MR review comments. |
|
moderation_result |
Boolean |
Definition MR approving result. |
|
moderation_time |
Long |
Definition MR approving time. |
|
moderation_status |
Integer |
Definition MR approving status. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition User ID. Value range: 1~2147483647 |
|
name |
String |
Definition Username. |
|
username |
String |
Definition Username. |
|
state |
String |
Definition: User status Value range:
Enumeration values:
|
|
service_license_status |
Integer |
Service-level permission status. 0: disabled; 1: enabled |
|
avatar_url |
String |
User profile picture URL |
|
avatar_path |
String |
User profile picture path |
|
|
String |
User email |
|
name_cn |
String |
Username (CN) |
|
web_url |
String |
User homepage |
|
nick_name |
String |
User alias |
|
tenant_name |
String |
Tenant name |
|
error_message |
String |
Definition When some query APIs detect that the user permission in the transfer parameter is insufficient or the user does not exist, the user is returned but the field is not empty for information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Repository ID. |
|
description |
String |
Repository description |
|
name |
String |
Repository name |
|
name_with_namespace |
String |
Organization name/Organization name.../Repository name |
|
path |
String |
Repository path |
|
path_with_namespace |
String |
Complete repository path |
|
created_at |
String |
Creation time |
|
updated_at |
String |
Update time. |
|
archived |
Boolean |
Archived or not |
|
is_kia |
Boolean |
Confidential or not |
|
ssh_url_to_repo |
String |
Repository SSH address |
|
http_url_to_repo |
String |
Repository HTTP address |
|
web_url |
String |
Repository page link |
|
readme_url |
String |
Link to the readme file of the repository |
|
project_id |
String |
Project ID |
|
project_name |
String |
Project name |
|
develop_mode |
String |
Repository development modes: normal and CR |
|
moderation_result |
Boolean |
Approving status |
|
Parameter |
Type |
Description |
|---|---|---|
|
notes_count |
Integer |
Total number of review comments |
|
unresolved_notes_count |
Integer |
Number of unresolved review comments |
|
already_resolved_count |
Integer |
Number of resolved review comments |
|
need_resolved_count |
Integer |
Total number of review comments to be resolved |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. |
|
error_msg |
String |
Definition Error message. |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. |
|
error_msg |
String |
Definition Error message. |
Example Requests
None
Example Responses
Status code: 200
Success.
{
"id" : 72674,
"iid" : 7,
"title" : "Creating a File",
"source_branch" : "ddd1",
"target_branch" : "master",
"state" : "opened",
"created_at" : "2025-05-21T12:03:32.000+08:00",
"updated_at" : "2025-06-17T15:30:02.000+08:00",
"source_repository_id" : 2111983939,
"review_mode" : "approval",
"author" : {
"id" : 9124,
"name" : "test",
"username" : "c369c68f1ff84679b5a8ed904d8bff1c",
"state" : "active",
"service_license_status" : null,
"name_cn" : "test",
"nick_name" : "beta_dv",
"tenant_name" : "example_name",
"error_message" : null
},
"closed_at" : "2025-05-21T12:03:32.000+08:00",
"closed_by" : null,
"merged_at" : null,
"merged_by" : null,
"pipeline_status" : "",
"codequality_status" : null,
"pipeline_status_with_code_quality" : "",
"notes" : 0,
"web_url" : "https://example.com/********/2111983939/7/mergedetail?source=ddd1&target=master",
"added_lines" : 0,
"removed_lines" : 0,
"merge_request_type" : "MergeRequest",
"source_git_url" : "git@example.com:3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
"labels" : [ {
"color" : "#000",
"name" : "Bug",
"description" : "456",
"id" : 8,
"title" : "Bug",
"type" : null,
"textColor" : "#FFFFFF"
}, {
"color" : "#000",
"name" : "bug",
"description" : "456",
"id" : 7,
"title" : "bug",
"type" : null,
"textColor" : "#FFFFFF"
} ],
"score" : 0,
"min_merged_score" : null,
"source_project_id" : "3e1f6634946144c2b1ccb46fb8152b8f",
"target_project_id" : null,
"product_name" : null,
"notes_count" : null,
"moderation_result" : null,
"moderation_time" : null,
"moderation_status" : null,
"source_repository" : {
"id" : 2111983939,
"description" : "ddd",
"name" : "dddd",
"name_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
"path" : "dddd",
"path_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
"created_at" : "2024-11-30T17:46:46.000+08:00",
"updated_at" : "2024-11-30T17:46:46.000+08:00",
"archived" : false,
"ssh_url_to_repo" : "git@example.com:3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
"http_url_to_repo" : "https://example.com/3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
"project_id" : null,
"project_name" : null,
"develop_mode" : null,
"moderation_result" : null
},
"target_repository" : {
"id" : 2111983939,
"description" : "ddd",
"name" : "dddd",
"name_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
"path" : "dddd",
"path_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
"created_at" : "2024-11-30T17:46:46.000+08:00",
"updated_at" : "2024-11-30T17:46:46.000+08:00",
"archived" : false,
"ssh_url_to_repo" : "git@example.com:3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
"http_url_to_repo" : "https://example.com/3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
"project_id" : null,
"project_name" : null,
"develop_mode" : null,
"moderation_result" : null
}
}
Status code: 401
Unauthenticated.
{
"error_code" : "CH.00000002",
"error_msg" : "Failed to verify authentication information."
}
Status code: 404
Not exist.
{
"error_code" : "CH.00402000",
"error_msg" : "The repository does not exist. Check and try again."
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Success. |
|
401 |
Unauthenticated. |
|
404 |
Not exist. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot