هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.
Replying to an MR Review
Function
This API is used to reply to an MR review.
URI
POST /v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions/{discussion_id}/notes
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
repository_id |
Yes |
Integer |
Explanation: Repository ID. Constraints: Mandatory Range: Minimum value: 1 Maximum value: 2147483647 |
merge_request_iid |
Yes |
Integer |
Explanation: MR IID (MR sequence number in the repository). Constraints: Mandatory Range: Minimum value: 1 Maximum value: 2147483647 |
discussion_id |
Yes |
String |
Comment ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Explanation: User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token. Constraints: Mandatory Range: 1–100,000 characters. Default value: None |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
body |
Yes |
String |
Explanation: Review comment content. Constraints: Mandatory 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. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Explanation: Response error code. |
result |
NoteDto 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 |
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 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: 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 |
---|---|---|
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 |
---|---|---|
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 |
Example Requests
POST https://{endpoint}/v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions/{discussion_id}/notes { "body" : "Reply content" }
Example Responses
Status code: 200
OK
{ "result": { "id": 2111974340, "type": "DiffNote", "body": "Reply content", "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-30T10:47:54.000+08:00", "updated_at": "2024-07-30T10:47:54.000+08:00", "system": false, "noteable_id": 38517, "noteable_type": "MergeRequest", "resolvable": true, "is_reply": true, "noteable_iid": 18, "discussion_id": "996f57b8fdd5e62678b16f0ea4f91688405fa72f", "project": "sll_test00006/mr_test", "diff_file": "a.txt", "diff": "@@ -0,0 +1,0 @@\n+1\r\n", "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, "is_outdated": false }, "status": "success" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
Error codes
Status Code |
Error Code |
Error Message |
Description |
Measure |
---|---|---|---|---|
400 |
CH.00401999 |
'body': The body is out of max length (8000 characters). |
The review comment exceeds 8,000 characters. |
Reduce the content. |
400 |
CH.00401015 |
String cannot contain emoticons or uncommon characters |
Only Unicode characters from \u0000 to \uffff can be used. Special characters, such as emojis and uncommon characters, are not supported. |
Delete the special characters. |
404 |
CH.00406001 |
MergeRequest Not Found |
MR information is not found. |
Refresh the MR page and try again. |
404 |
CH.00406048 |
note not found by noteId |
No review comment is found for the associated repository_id, merge_request_iid, and discussion_id. |
Check and modify the input parameters. |
404 |
CH.00406049 |
incorrect type of note |
No review comment is found for the associated repository_id, merge_request_iid, and discussion_id. |
Check and modify the input parameters. |
404 |
CH.00406050 |
note does not belong to this commit or merge request |
No review comment is found for the associated repository_id, merge_request_iid, and discussion_id. |
Check and modify the input parameters. |
405 |
CH.00406019 |
The current merge mergequest is not allowed to be reviewed after being merged, change the settings to enable this operation |
Adding comments to merged MRs is not allowed. |
Modify the MR settings. |
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