Obtaining the List of Review Comments for a Single Commit on a Code Page
Function
This API is used to obtain the list of review comments for a single commit on a code page.
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:getRepository |
Read |
- |
- |
- |
- |
URI
GET https://{hostURL}/v4/repositories/{repository_id}/commits/{sha}/discussions
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
repository_id |
Yes |
Integer |
Definition You can query the project list to obtain the repository ID by calling the API used to query user's all repositories. Constraints N/A Default Value N/A Value range: 1~2147483647 |
|
sha |
Yes |
String |
Definition Commit ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
sort |
No |
String |
Definition Sort review comments.
|
|
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 |
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 |
|---|---|---|
|
[items] |
Array of CommitDiscussionDto objects |
A single commit review comment |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Definition: Review comment ID, which is shared by the main comment and replies. |
|
individual_note |
Boolean |
Definition: Personal review comments (no need to be resolved) |
|
notes |
Array of CommitNoteDto objects |
Definition: Comment list (main comment and replies) |
|
repository_id |
Integer |
Definition: Repository ID Value range: 1~2147483647 |
|
noteable_type |
String |
Definition: Comment type Enumeration values:
|
|
commit_id |
String |
Definition: Commit record ID |
|
repository_full_path |
String |
Definition: Repository path |
|
a_mode |
String |
Definition: Old permission for the file (default value: 100644) |
|
b_mode |
String |
Definition: New permission for the file (default value: 100644) |
|
deleted_file |
Boolean |
Definition: Deleted file or not |
|
new_file |
Boolean |
Definition: New file or not |
|
diff_file |
Boolean |
Definition: Modified file or not |
|
added_lines |
Integer |
Definition: Number of new lines in the file that contains review comments. Value range: 0~2147483647 |
|
removed_lines |
Integer |
Definition: Number of deleted lines in the file that contains review comments Value range: 0~2147483647 |
|
resolved |
Boolean |
Definition: Resolved or not |
|
archived |
Boolean |
Definition: Archived or not |
|
review_categories |
String |
Definition: Comment type key |
|
review_categories_cn |
String |
Definition: Comment type (CN) |
|
review_categories_en |
String |
Definition: Comment type |
|
review_modules |
String |
Definition: Comment module |
|
severity |
String |
Definition: Severity key Enumeration values:
|
|
severity_cn |
String |
Definition: Severity (CN) Constraints:
|
|
severity_en |
String |
Definition: Severity Enumeration values:
|
|
assignee |
UserBasicDto object |
Definition: Assignee |
|
proposer |
UserBasicDto object |
Definition: Reviewer |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition: Comment ID, which is not shared by the main comment and replies Value range: 1~2147483647 |
|
noteable_type |
String |
Definition: Comment type Enumeration values:
|
|
commit_id |
String |
Definition: Commit record ID |
|
discussion_id |
String |
Definition: Review comment ID, which is shared by the main comment and replies |
|
type |
String |
Definition: Type (common comment, common comment to be resolved, and comment on the associated code line to be resolved.) Enumeration values:
|
|
body |
String |
Definition: Comment content |
|
diff_file |
String |
Definition: Name of the file that contains the associated code lines |
|
diff |
String |
Definition: Code snippet associated with the lines of code |
|
attachment |
String |
Definition: Attachment (deprecated) |
|
author |
UserBasicDto object |
Definition: Comment author |
|
created_at |
String |
Definition: Creation time |
|
updated_at |
String |
Definition: Update time |
|
system |
Boolean |
Definition: Added by the system or not |
|
noteable_id |
Integer |
Definition: MR ID or issue ID Value range: 1~2147483647 |
|
position |
PositionDto object |
Definition: Associated code line location information |
|
resolvable |
Boolean |
Definition: Whether need to be resolved. |
|
resolved |
Boolean |
Definition: Resolved or not |
|
resolved_by |
UserBasicDto object |
Definition: Resolved by |
|
archived |
Boolean |
Definition: Archived or not |
|
noteable_iid |
Integer |
Definition: MR IID or issue IID Value range: 1~2147483647 |
|
review_categories |
String |
Definition: Comment type key |
|
review_categories_cn |
String |
Definition: Comment type name (CN) |
|
review_categories_en |
String |
Definition: MR version information |
|
review_modules |
String |
Definition: MR version information |
|
severity |
String |
Definition: Severity key Enumeration values:
|
|
severity_cn |
String |
Definition: Severity (CN) Constraints:
|
|
severity_en |
String |
Definition: Severity Enumeration values:
|
|
file_path |
String |
Definition: File path (deprecated) |
|
line |
String |
Definition: Line number (deprecated) |
|
assignee |
UserBasicDto object |
Definition: Assignee |
|
proposer |
UserBasicDto object |
Definition: Reviewer |
|
is_reply |
Boolean |
Definition: Reply or not |
|
moderation_result |
Boolean |
Definition: Content approving result |
|
moderation_time |
Long |
Definition: Content approving time |
|
moderation_status |
Integer |
Definition: Content approving status |
|
Parameter |
Type |
Description |
|---|---|---|
|
base_sha |
String |
Definition Basic SHA value. |
|
start_sha |
String |
Definition Start SHA value. |
|
head_sha |
String |
Definition Latest SHA value. |
|
old_path |
String |
Definition Old file path. |
|
new_path |
String |
Definition New file path. |
|
position_type |
String |
Definition File type. |
|
old_line |
Integer |
Definition Old file line No. |
|
new_line |
Integer |
Definition New file line No. |
|
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. |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. |
|
error_msg |
String |
Definition Error message. |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. |
|
error_msg |
String |
Definition Error message. |
Example Requests
/v4/repositories/123/merge-requests/321/discussions/discussioniduuid
{
"body" : "test"
}
Example Responses
Status code: 200
OK
[ {
"id" : "e9d749e5605aa14c1a1d08d98a27c720be840a91",
"individual_note" : false,
"notes" : [ {
"id" : 2112075950,
"noteable_type" : "Commit",
"commit_id" : "c83350b89ac89633165814797d356e25d3f5b857",
"discussion_id" : "e9d749e5605aa14c1a1d08d98a27c720be840a91",
"project" : "63f8d09cf49448879c96ca2c2b38f139/1/33333",
"type" : "DiffNote",
"body" : "test",
"diff_file" : 232,
"diff" : "@@ -00 +10 @@\\n+233232\\n",
"author" : {
"id" : 21820,
"name" : "tr8",
"username" : "ac105e52a4764a4c8f29b306508f016d",
"state" : "active",
"avatar_url" : null,
"email" : "ac105e52a4764a4c8f29b306508f016d@example.com",
"name_cn" : "tr8",
"web_url" : "https://example.com/ac105e52a4764a4c8f29b306508f016d",
"nick_name" : "example_name",
"tenant_name" : "example_name"
},
"created_at" : "2025-08-07T16:08:14.000+08:00",
"updated_at" : "2025-08-07T16:08:14.000+08:00",
"system" : false,
"position" : {
"base_sha" : "51077424e80441d99c0acbac7d8f5fd91392b3d0",
"start_sha" : "51077424e80441d99c0acbac7d8f5fd91392b3d0",
"head_sha" : "c83350b89ac89633165814797d356e25d3f5b857",
"old_path" : 232,
"new_path" : 232,
"position_type" : "text",
"new_line" : 1,
"is_left" : false
},
"resolvable" : true,
"resolved" : false,
"archived" : false,
"review_categories_cn" : null,
"review_categories_en" : null,
"severity" : "suggestion",
"severity_cn" : "Suggestions",
"severity_en" : "Suggestion",
"proposer" : {
"id" : 21820,
"name" : "tr8",
"username" : "ac105e52a4764a4c8f29b306508f016d",
"state" : "active",
"avatar_url" : null,
"email" : "ac105e52a4764a4c8f29b306508f016d@example.com",
"name_cn" : "tr8",
"web_url" : "https://example.com/ac105e52a4764a4c8f29b306508f016d",
"nick_name" : "example_name",
"tenant_name" : "example_name"
},
"is_reply" : false,
"moderation_result" : true,
"moderation_time" : 1754554094038,
"moderation_status" : 0
} ],
"noteable_type" : "Commit",
"commit_id" : "c83350b89ac89633165814797d356e25d3f5b857",
"project_full_path" : "63f8d09cf49448879c96ca2c2b38f139/1/33333",
"a_mode" : 0,
"b_mode" : 100644,
"deleted_file" : false,
"new_file" : true,
"diff_file" : "@@ -00 +10 @@\\n+233232\\n",
"added_lines" : 1,
"removed_lines" : 0,
"resolved" : false,
"archived" : false,
"review_categories_cn" : null,
"review_categories_en" : null,
"severity" : "suggestion",
"severity_cn" : "Suggestions",
"severity_en" : "Suggestion",
"proposer" : {
"id" : 21820,
"name" : "tr8",
"username" : "ac105e52a4764a4c8f29b306508f016d",
"state" : "active",
"avatar_url" : null,
"email" : "ac105e52a4764a4c8f29b306508f016d@example.com",
"name_cn" : "tr8",
"web_url" : "https://example.com/ac105e52a4764a4c8f29b306508f016d",
"nick_name" : "example_name",
"tenant_name" : "example_name"
}
} ]
Status code: 401
Unauthorized
{
"error_code" : "DEV.00000003",
"error_msg" : "Authentication information expired."
}
Status code: 403
Bad Request
{
"error_code" : "CH.004403",
"error_msg" : "Insufficient permissions. Apply for the required permissions and try again."
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
401 |
Unauthorized |
|
403 |
Bad Request |
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