Obtaining the Review Comments of a Single File on the Merge Request File Change Page.
Function
This API is used to obtain review comments of a single file on the file change page of a merge request.
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}/merge-requests/{merge_request_iid}/comments-by-line
|
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 |
|
merge_request_iid |
Yes |
Integer |
Definition MR internal ID (IID). Value range: 1~2147483647 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
line |
No |
Integer |
Definition Obtain review comments for a specific line. (Use the line number on the right margin to mark an added or unchanged line. Use the line number on the left margin to mark a deleted line.) Value range: 1~2147483647 |
|
with_commit_comments |
No |
Boolean |
Definition Whether to return comments added on the code tab page. Range
Default value: false |
|
path |
No |
String |
Definition File path. Range 1–100,000 characters. |
|
view |
No |
String |
Definition Whether to return only basic information. Range
Enumeration values:
|
|
base_sha |
No |
String |
Definition Common reference point of the source branch and target branch in an MR. Range A SHA-1 string of 40 characters. |
|
start_sha |
No |
String |
Definition In an MR, the first commit point in the direction starting from the common reference point to the source branch. Range A SHA-1 string of 40 characters. |
|
head_sha |
No |
String |
Definition Commit point to which the source branch directs in an MR. Range A SHA-1 string of 40 characters. |
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 CommentPathDto objects |
Review comment details under a single file. |
|
Parameter |
Type |
Description |
|---|---|---|
|
new |
Array of LineDiscussionDto objects |
Definition Review comment collection on the right of the file comparison result. |
|
old |
Array of LineDiscussionDto objects |
Definition Review comment collection on the left of the file comparison result. |
|
path |
String |
Definition File name. |
|
Parameter |
Type |
Description |
|---|---|---|
|
discussions |
Array of MergeRequestBasicDiscussionDto objects |
Definition Review comment collection in a line on a side. |
|
line |
Integer |
Definition Line No. |
|
type |
String |
Definition: Line type Value range: old: deleted line on the left new: added line on the right unchanged-l: unchanged line on the left unchanged-r: unchanged line on the right Enumeration values:
|
|
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 NoteDto objects |
Definition Comment list (main comment and replies). |
|
repository_id |
Integer |
Definition Repository ID. Value range: 1~2147483647 |
|
noteable_type |
String |
Definition: Comment type Value range:
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. |
|
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 Value range:
Enumeration values:
|
|
severity_cn |
String |
Definition: Severity (CN) Value range:
|
|
severity_en |
String |
Definition: Severity (EN) Value range:
Enumeration values:
|
|
assignee |
UserBasicDto object |
Definition Assignee. |
|
proposer |
UserBasicDto object |
Definition Reviewer. |
|
merge_request_version_params |
MergeRequestVersionParamsDto object |
Definition MR version information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition Comment ID, which is not shared by the main comment and replies. Value range: 1~2147483647 |
|
type |
String |
Definition: Review types Value range:
|
|
body |
String |
Definition Comment content. |
|
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 |
|
noteable_type |
String |
Definition: Comment type Value range:
Enumeration values:
|
|
commit_id |
String |
Definition Commit record ID. |
|
resolvable |
Boolean |
Definition Whether need to be resolved. |
|
is_reply |
Boolean |
Definition Reply or not. |
|
resolved_by |
UserBasicDto object |
Definition Solver. |
|
noteable_iid |
Integer |
Definition MR IID or issue IID. Value range: 1~2147483647 |
|
discussion_id |
String |
Definition Review comment ID, which is shared by the main comment and replies. |
|
repository |
String |
Definition Repository path. |
|
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. |
|
archived |
Boolean |
Definition Archived or not. |
|
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. |
|
position |
PositionDto object |
Definition Associated code line location information. |
|
resolved |
Boolean |
Definition Resolved or not. |
|
is_outdated |
Boolean |
Definition Expired 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. |
|
Parameter |
Type |
Description |
|---|---|---|
|
diff_id |
Integer |
Definition Version ID (composed of the MR ID and SHA value). |
|
start_sha |
String |
Definition Start SHA value. |
|
commit_id |
String |
Definition Commit record ID. |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. |
|
error_msg |
String |
Definition Error message. |
Example Requests
GET https://{endpoint}/v4/repositories/2112015538/merge-requests/1/comments-by-line
Example Responses
Status code: 200
Obtain the review comments of a single file on the merge request file change page.
success
Status code: 401
Unauthorized
{
"error_code" : "DEV.00000003",
"error_msg" : "Authentication information expired."
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Obtain the review comments of a single file on the merge request file change page. |
|
401 |
Unauthorized |
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