Create MR Review Comments
Function
Create MR Review Comments
URI
POST /v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
repository_id |
Yes |
Integer |
Warehouse Short ID Minimum: 1 Maximum: 2147483647 |
merge_request_iid |
Yes |
Integer |
ID of the combination request. Minimum: 1 Maximum: 2147483647 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. Can be obtained by calling the IAM API for obtaining the user token (the value of X-Subject-Token in the response header). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
body |
Yes |
String |
Review Comments |
severity |
No |
String |
Severity |
assignee_id |
No |
String |
Assigner ID |
review_categories |
No |
String |
Classification of Review Comments |
review_modules |
No |
String |
Review Comment Module |
proposer_id |
No |
String |
Proposer ID |
position |
No |
PositionDto object |
Code Location Information |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
base_sha |
No |
String |
Base submission node of the source branch |
start_sha |
No |
String |
Latest submission node of the target branch |
head_sha |
No |
String |
Latest Submission Node of Source Branch |
old_path |
No |
String |
File Path Before Modification |
new_path |
No |
String |
File Path After Modification |
position_type |
No |
String |
Change Type |
old_line |
No |
Integer |
Line No. Before Modification |
new_line |
No |
Integer |
Line No. After Modification |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Response error. |
result |
MergeRequestDiscussionDto object |
Response result. |
status |
String |
Response status |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Identifies a comment. |
individual_note |
Boolean |
individual_note |
notes |
Array of NoteDto objects |
Main Review and Reply List Array Length: 0 - 1 |
project_id |
Integer |
Specifies the repository ID. Minimum: 1 Maximum: 2147483647 |
noteable_type |
String |
Destination Type |
commit_id |
String |
Associated submission ID. |
project_full_path |
String |
Repository Path |
a_mode |
String |
File Mode Before Change |
b_mode |
String |
File Mode After Change |
deleted_file |
Boolean |
Indicates whether to delete files during the change. |
new_file |
Boolean |
Whether a file is added for this change |
resolved |
Boolean |
Check whether the problem is solved according to the review comments. |
archived |
Boolean |
Check whether the review comments are archived. |
review_categories |
String |
Classification of Review Comments |
review_categories_cn |
String |
Review Comment Category (Zh) |
review_categories_en |
String |
Review Comment Category (En) |
review_modules |
String |
Review Comment Module |
severity |
String |
Severity |
severity_cn |
String |
Severity (Zh) |
severity_en |
String |
Severity (En) |
assignee |
UserBasicDto object |
Assigned By |
proposer |
UserBasicDto object |
Raised By |
merge_request_version_params |
MergeRequestVersionParamsDto object |
MR version information |
diff_file |
String |
Modified Files |
added_lines |
Integer |
New Rows Minimum: 1 Maximum: 2147483647 |
removed_lines |
Integer |
Number of deleted rows Minimum: 1 Maximum: 2147483647 |
Parameter |
Type |
Description |
---|---|---|
id |
Integer |
note id Minimum: 1 Maximum: 2147483647 |
type |
String |
Note Type |
body |
String |
Review Comments |
attachment |
String |
Attachment |
author |
UserBasicDto object |
Author |
created_at |
String |
Created |
updated_at |
String |
Updated |
system |
Boolean |
Indicates whether the log is generated by the system. |
noteable_id |
Integer |
Target ID Minimum: 1 Maximum: 2147483647 |
noteable_type |
String |
Destination Type |
commit_id |
String |
Associated submission ID. |
resolvable |
Boolean |
Whether the Problem Can Be Solved |
is_reply |
Boolean |
Indicates whether to reply. |
resolved_by |
UserBasicDto object |
Solution providing person |
noteable_iid |
Integer |
Target iid Minimum: 1 Maximum: 2147483647 |
discussion_id |
String |
Discussion ID |
project |
String |
Project |
diff_file |
String |
Modified Files |
diff |
String |
Change Description |
archived |
Boolean |
Archived or Not |
review_categories |
String |
Classification of Review Comments |
review_categories_cn |
String |
Review Comment Category (Zh) |
review_categories_en |
String |
Review Comment Category (En) |
review_modules |
String |
Review Comment Module |
severity |
String |
Severity |
severity_cn |
String |
Severity (Zh) |
severity_en |
String |
Severity (En) |
file_path |
String |
File Path |
line |
String |
Line number |
assignee |
UserBasicDto object |
Assigned By |
proposer |
UserBasicDto object |
Raised By |
position |
PositionDto object |
Associated Code Location |
resolved |
Boolean |
Resolved or Not |
is_outdated |
Boolean |
Outdated or Not |
Parameter |
Type |
Description |
---|---|---|
base_sha |
String |
Base submission node of the source branch |
start_sha |
String |
Latest submission node of the target branch |
head_sha |
String |
Latest Submission Node of Source Branch |
old_path |
String |
File Path Before Modification |
new_path |
String |
File Path After Modification |
position_type |
String |
Change Type |
old_line |
Integer |
Line No. Before Modification |
new_line |
Integer |
Line No. After Modification |
Parameter |
Type |
Description |
---|---|---|
id |
Integer |
Specifies the user ID. Minimum: 1 Maximum: 2147483647 |
name |
String |
Name |
username |
String |
User Name |
state |
String |
Status |
avatar_url |
String |
Avatar URL. |
avatar_path |
String |
Profile picture path. |
|
String |
|
name_cn |
String |
Name |
web_url |
String |
Home Page |
nick_name |
String |
MAILNICKNAME |
tenant_name |
String |
Tenant name. |
Example Requests
POST https://{endpoint}/v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions { "body" : "Review comment", "position" : { "new_path" : "a.txt", "old_path" : "a.txt", "new_line" : 1, "old_line" : -1 }, "severity" : "suggestion" }
Example Responses
Status code: 200
OK
{ "result" : { "id" : "b7d95c35c08e0b328bfbafd45408bd2ac28b73f9", "individual_note" : false, "notes" : [ { "id" : 2111886200, "type" : "DiffNote", "body" : "Review Comments", "author" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "created_at" : "2023-06-01T17:05:12.000+08:00", "updated_at" : "2023-06-01T17:05:12.000+08:00", "system" : false, "noteable_id" : 19387, "noteable_type" : "MergeRequest", "resolvable" : true, "is_reply" : true, "noteable_iid" : 2, "discussion_id" : "8bbe6d4e797169c4c1ce56507fdf1abc11f95601", "project" : "DevOpsqlcylxm00004/project-test", "diff_file" : "7", "diff" : "@@ -0,0 +1,0 @@\n+7\n", "archived" : false, "review_categories" : "regulations", "review_categories_cn" : "Programming Regulations", "review_categories_en" : "Regulations", "review_modules" : "aaa,bbb", "severity" : "suggestion", "assignee" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "proposer" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "position" : { "base_sha" : "973bcc0211c32dbaa8473561c6767f74e1a81471", "start_sha" : "973bcc0211c32dbaa8473561c6767f74e1a81471", "head_sha" : "f5bf0230f9b996ed6c0d64d2b2fef789d91b164c", "old_path" : "7", "new_path" : "7", "position_type" : "text", "new_line" : 1 }, "resolved" : false, "is_outdated" : false } ], "project_id" : 2111699786, "noteable_type" : "MergeRequest", "project_full_path" : "DevOpsqlcylxm00004/project-test", "a_mode" : "0", "b_mode" : "100644", "deleted_file" : false, "new_file" : true, "resolved" : false, "archived" : false, "review_categories" : "regulations", "review_categories_cn" : "Programming Regulations", "review_categories_en" : "Regulations", "review_modules" : "aaa,bbb", "severity" : "suggestion", "severity_cn" : "Suggestions", "severity_en" : "Suggestion", "assignee" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "proposer" : { "id" : 1234, "name" : "beta", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "name_cn" : "beta" }, "diff_file" : "@@ -0,0 +1,0 @@\n+7\n", "added_lines" : 1, "removed_lines" : 0 }, "status" : "success" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
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