Obtaining a Review List
Function
This API is used to obtain a review list.
URI
GET /v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
repository_id |
Yes |
String |
Explanation: Repository ID. Constraints: Mandatory Range: Minimum value: 1 Maximum value: 214748364 |
merge_request_iid |
Yes |
Integer |
Explanation: MR IID (MR sequence number in the repository). Constraints: Mandatory Range: Minimum value: 1 Maximum value: 2147483647 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
No |
String |
Explanation: Review comment type. Range:
|
unresolved |
No |
String |
Explanation: Whether to return unresolved reviews. Range:
|
view |
No |
String |
Explanation: Whether to return basic or detailed information. Range:
|
author_id |
No |
String |
Explanation: A user ID or username for filtering review comments created by a user. Range: Max. 255 characters. |
page |
No |
Integer |
Explanation: Number of the page whose review comments will be returned. Range: Minimum value: 1 Maximum value: 2147483647 Default value: 1 |
per_page |
No |
Integer |
Explanation: Pagination parameter, which indicates the number of comments displayed on each page. Range: Minimum value: 1 Maximum value: 100 Default value: 20 |
Request Parameters
None.
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Explanation: Response error code. |
result |
Array of MergeRequestDiscussionDto object |
Explanation: Review comment information. Range: None |
status |
String |
Explanation: Response status. Range:
|
Parameter |
Type |
Description |
---|---|---|
code |
String |
Explanation: Error code returned when the API fails to be called. Range:
|
message |
String |
Explanation: Error message returned when the API fails to be called. Range:
|
Parameter |
Type |
Description |
---|---|---|
id |
String |
Explanation: ID shared by the main comment and reply, which is generally called discussion_id. Range: 40 digits and letters. |
individual_note |
Boolean |
Explanation: Whether the comment is individual and does not need resolution by others. Range:
|
notes |
Array of NoteDto objects |
Explanation: Main comment and reply list. The first one is the main comment. (This API is used to create a main comment. Therefore, there is only one comment.) Range: None |
project_id |
Integer |
Explanation: Repository ID. Range: Minimum value: 1 Maximum value: 2147483647 |
noteable_type |
String |
Explanation: Comment type. Range:
|
commit_id |
String |
Explanation: Associated commit ID: SHA value of a commit. This field applies when noteable_type is set to Commit. Range: 40 digits and letters. |
project_full_path |
String |
Explanation: Repository path. Range: None |
a_mode |
String |
Explanation: Mode of an associated file before the change. If the file is new, the value is 0. Range: File permissions supported by Git, for example, 100644, 100755, 120000, and 160000. |
b_mode |
String |
Explanation: Mode of an associated file after the change. If the file is deleted, the value is 0. Range: File permissions supported by Git, for example, 100644, 100755, 120000, and 160000. |
deleted_file |
Boolean |
Explanation: Whether an associated file is deleted. Range:
|
new_file |
Boolean |
Explanation: Whether an associated file is new. Range:
|
resolved |
Boolean |
Explanation: Whether the review comment has been resolved. Range:
|
archived |
Boolean |
Explanation: Whether the review comment has been archived. Archived comments cannot be edited, deleted, replied, or resolved. Range:
|
review_categories |
String |
Explanation: Comment type key. The values of review_categories and review_categories_cnreview_categories_en must match. Range: None |
review_categories_cn |
String |
Explanation: Comment type in Chinese. The values of review_categories and review_categories_cn must match. Range: None |
review_categories_en |
String |
Explanation: Comment type in English. The values of review_categories and review_categories_en must match. Range: None |
review_modules |
String |
Explanation: Review comment module. Range: None |
severity |
String |
Explanation: Review comment severity key. Range:
|
severity_cn |
String |
Explanation: Severity in Chinese. Range:
|
severity_en |
String |
Explanation: Severity in English. Range:
|
assignee |
UserBasicDto object |
Explanation: Assignee details. Range: None |
proposer |
UserBasicDto object |
Explanation: Reviewer details. Range: None |
merge_request_version_params |
MergeRequestVersionParamsDto object |
Explanation: MR version details. Range: None |
diff_file |
String |
Explanation: File path change. Range: None |
added_lines |
Integer |
Explanation: Number of new lines. Range: Minimum value: 0 Maximum value: 2147483647 |
removed_lines |
Integer |
Explanation: Number of deleted lines. Range: Minimum value: 0 Maximum value: 2147483647 |
Parameter |
Type |
Description |
---|---|---|
id |
Integer |
Explanation: Comment ID, which is not shared by the main comment and replies. Range: Minimum value: 1 Maximum value: 2147483647 |
type |
String |
Explanation: Note type. Range:
|
body |
String |
Explanation: Review comment content. Range: Maximum length: 8,000 characters. Characters: Unicode \u0000 to \uffff. Special characters, such as emojis and uncommon characters, are not supported. Blank: The value cannot be null, an empty string, or only spaces. |
attachment |
String |
Explanation: Attachment. (This field has been discarded.) Range: None |
author |
UserBasicDto object |
Explanation: Author details. Range: None |
created_at |
String |
Explanation: Creation time. Constraints: Format: yyyy-MM-ddTHH:mm:ss.SSS+08:00 |
updated_at |
String |
Explanation: Update time. Constraints: Format: yyyy-MM-ddTHH:mm:ss.SSS+08:00 |
system |
Boolean |
Explanation: Whether the comment is generated by the system. Range:
|
noteable_id |
Integer |
Explanation: MR ID. Range: Minimum value: 1 Maximum value: 2147483647 |
noteable_type |
String |
Explanation: Comment type. Range:
|
commit_id |
String |
Explanation: Associated commit ID: SHA value of a commit. This field applies when noteable_type is set to Commit. Range: 40 digits and letters. |
resolvable |
Boolean |
Explanation: Whether the comment needs to be resolved. Range:
|
is_reply |
Boolean |
Explanation: Whether the comment is a reply. Range:
|
resolved_by |
UserBasicDto object |
Explanation: Comment resolver. Range: None |
noteable_iid |
Integer |
Explanation: MR IID, indicating the sequence number of the MR in the repository. Range: Minimum value: 1 Maximum value: 2147483647 |
discussion_id |
String |
Explanation: Review comment ID, which is shared by the main comment and replies. Range: 40 digits and letters. |
project |
String |
Explanation: Project path. Range: None |
diff_file |
String |
Explanation: File path change. Range: None |
diff |
String |
Explanation: File content change. Range: None |
archived |
Boolean |
Explanation: Whether the review comment has been archived. Archived comments cannot be edited, deleted, replied, or resolved. Range:
|
review_categories |
String |
Explanation: Comment type key. The values of review_categories, review_categories_cn, and review_categories_en must match. Range: None |
review_categories_cn |
String |
Explanation: Comment type in Chinese. The values of review_categories and review_categories_cn must match. Range: None |
review_categories_en |
String |
Explanation: Comment type in English. The values of review_categories and review_categories_en must match. Range: None |
review_modules |
String |
Explanation: Review comment module. Range: None |
severity |
String |
Explanation: Severity. Non-suggestion reviews cannot be resolved by the assignee, MR creator, or committer. Range:
|
severity_cn |
String |
Explanation: Severity in Chinese. Range:
|
severity_en |
String |
Explanation: Severity in English. Range:
|
file_path |
String |
Explanation: File path. (This field has been discarded.) Range: None |
line |
String |
Explanation: Line number. (This field has been discarded.) Range: None |
assignee |
UserBasicDto object |
Explanation: Assignee details. Range: None |
proposer |
UserBasicDto object |
Explanation: Reviewer details. Range: None |
position |
PositionDto object |
Explanation: Code location information to associate the comment with. Range: None |
resolved |
Boolean |
Explanation: Whether the review comment has been resolved. Range:
|
is_outdated |
Boolean |
Explanation: Whether the review comment is for the latest commit. Range:
|
Parameter |
Type |
Description |
---|---|---|
base_sha |
String |
Explanation: Base commit node of the source branch. Range: 40 digits and letters. |
start_sha |
String |
Explanation: Latest commit node of the source branch. Range: 40 digits and letters. |
head_sha |
String |
Explanation: Latest commit node of the target branch. Range: 40 digits and letters. |
old_path |
String |
Explanation: Old file path. Range: None |
new_path |
String |
Explanation: New file path. Range: None |
position_type |
String |
Explanation: Change type. Range: None Default value: text |
old_line |
Integer |
Explanation: Line number before change. If the value is less than or equal to 0 or is null, the line is new and displayed in green on the right for comparison. Range: –1 to 2147483647 or null |
new_line |
Integer |
Explanation: New line No. If the value is less than or equal to 0 or is null, the line is deleted and displayed in red on the left for comparison. Range: –1 to 2147483647 or null |
Parameter |
Type |
Description |
---|---|---|
id |
Integer |
Explanation: User ID. Range: Minimum value: 1 Maximum value: 2147483647 |
name |
String |
Explanation: Name. Range: Max. 255 characters. |
username |
String |
Explanation: Username. Range: Max. 255 characters. |
state |
String |
Explanation: Status. Range: Max. 255 characters. |
avatar_url |
String |
Explanation: URL for obtaining the profile picture. Range: None |
avatar_path |
String |
Explanation: Path for obtaining the profile picture. Range: None |
|
String |
Explanation: Email address. Range: None |
name_cn |
String |
Explanation: Chinese name. Constraints: The value is the same as that of username. This field has been discarded. Range: None |
web_url |
String |
Explanation: Homepage URL. Range: None |
nick_name |
String |
Explanation: Alias. Range: None |
tenant_name |
String |
Explanation: Tenant name. Range: None |
Parameter |
Type |
Description |
---|---|---|
diff_id |
Integer |
Explanation: Each MR version has a unique diff_id. (In this API, the MR version is the latest.) Range: Minimum value: 1 Maximum value: 2147483647 |
start_sha |
String |
Explanation: Latest commit node of the target branch. Range: 40 digits and letters. |
commit_id |
String |
Explanation: Associated commit ID: SHA value of a commit. This field applies when noteable_type is set to Commit. Range: 40 digits and letters. |
Example Requests
GET https://{endpoint}/v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions?type=user&page=1&per_page=20&unresolved=&view=basic
Example Responses
Status code: 200
OK
{
"result": [
{
"id": "996f57b8fdd5e62678b16f0ea4f91688405fa72f",
"individual_note": false,
"notes": [
{
"id": 2111974336,
"type": "DiffNote",
"body": "Review comment",
"author": {
"id": 9124,
"name": "CodeHub_beta_dev",
"username": "c369c68f1ff84679b5a8ed904d8bff1c",
"state": "active",
"avatar_url": "",
"email": "liujian@example.com",
"name_cn": "CodeHub_beta_dev",
"web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
"nick_name": "Alias",
"tenant_name": "devcloud_codehub_l00314597_01"
},
"created_at": "2024-07-29T22:01:37.000+08:00",
"updated_at": "2024-07-29T22:01:37.000+08:00",
"system": false,
"resolvable": true,
"is_reply": false,
"discussion_id": "996f57b8fdd5e62678b16f0ea4f91688405fa72f",
"archived": false,
"review_categories": "Type",
"review_categories_cn": "Type",
"review_categories_en": "Type",
"review_modules": "Module",
"severity": "suggestion",
"severity_cn": "Suggestion",
"severity_en": "Suggestion",
"assignee": {
"id": 9124,
"name": "CodeHub_beta_dev",
"username": "c369c68f1ff84679b5a8ed904d8bff1c",
"state": "active",
"avatar_url": "",
"email": "liujian@example.com",
"name_cn": "CodeHub_beta_dev",
"web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
"nick_name": "Alias",
"tenant_name": "devcloud_codehub_l00314597_01"
},
"proposer": {
"id": 9124,
"name": "CodeHub_beta_dev",
"username": "c369c68f1ff84679b5a8ed904d8bff1c",
"state": "active",
"avatar_url": "",
"email": "liujian@example.com",
"name_cn": "CodeHub_beta_dev",
"web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
"nick_name": "Alias",
"tenant_name": "devcloud_codehub_l00314597_01"
},
"position": {
"base_sha": "a9ce1513d5185d5fe2bac52c597f204ce695c4be",
"start_sha": "a9ce1513d5185d5fe2bac52c597f204ce695c4be",
"head_sha": "53c75fa88dc4e7d0b68d108b7f1ee0a5c4564f44",
"old_path": "a.txt",
"new_path": "a.txt",
"position_type": "text",
"new_line": 1
},
"resolved": false
}
],
"project_id": 2111704470,
"noteable_type": "MergeRequest",
"project_full_path": "sll_test00006/mr_test",
"a_mode": "0",
"b_mode": "100644",
"deleted_file": false,
"new_file": true,
"resolved": false,
"archived": false,
"review_categories": "Type",
"review_categories_cn": "Type",
"review_categories_en": "Type",
"review_modules": "Module",
"severity": "suggestion",
"severity_cn": "Suggestion",
"severity_en": "Suggestion",
"assignee": {
"id": 9124,
"name": "CodeHub_beta_dev",
"username": "c369c68f1ff84679b5a8ed904d8bff1c",
"state": "active",
"avatar_url": "",
"email": "liujian@example.com",
"name_cn": "CodeHub_beta_dev",
"web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
"nick_name": "Alias",
"tenant_name": "devcloud_codehub_l00314597_01"
},
"proposer": {
"id": 9124,
"name": "CodeHub_beta_dev",
"username": "c369c68f1ff84679b5a8ed904d8bff1c",
"state": "active",
"avatar_url": "",
"email": "liujian@example.com",
"name_cn": "CodeHub_beta_dev",
"web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
"nick_name": "Alias",
"tenant_name": "devcloud_codehub_l00314597_01"
},
"merge_request_version_params": {}
}
],
"status": "success"
}
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
Error codes
Status Code |
Error Code |
Error Message |
Description |
Measure |
---|---|---|---|---|
404 |
CH.00406001 |
MergeRequest Not Found |
MR information is not found. |
Refresh the MR page and try again. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.