CreateChangeRequestComment - Create a merge request comment
Create a comment on a merge request by calling this API operation.
|
Applicable editions |
Central edition, Region edition |
Endpoints and authorization information
-
Obtain an endpoint: Replace {domain} in the API request syntax.
-
Obtain the organizationId: Required only for the Central edition. Go to the Basic Information page in the Tenant Management console to obtain the organization ID.
|
Product |
Resource |
Required permission |
|
Code Management |
Merge Request |
Read/Write |
Request syntax
Central edition
POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/changeRequests/{localId}/comments
Region edition
POST https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/changeRequests/{localId}/comments
Request headers
|
Parameter |
Type |
Required |
Description |
Example |
|
x-yunxiao-token |
string |
Yes |
Personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example |
|
organizationId |
string |
path |
|
The organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
The repository ID or the URL-encoded full path of the repository. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
|
localId |
integer |
path |
Yes |
The local ID of the merge request in the repository. |
1 |
| - |
object |
body |
No |
||
|
comment_type |
string |
body |
Yes |
The type of the comment. |
GLOBAL_COMMENT,INLINE_COMMENT |
|
content |
string |
body |
Yes |
The content of the comment. The length must be between 1 and 65,535 characters. |
This is a comment content. |
|
draft |
boolean |
body |
Yes |
Whether the comment is a draft. |
true |
|
file_path |
string |
body |
No |
The file name. Valid only for inline comments. |
/src/main/java/com/example/MyClass.java |
|
from_patchset_biz_id |
string |
body |
No |
The source patch set ID for comparison. Required for INLINE_COMMENT comments. |
bf117304dfe44d5d9b1132f348edf92e |
|
line_number |
integer |
body |
No |
The line number. Valid only for inline comments. |
42 |
|
parent_comment_biz_id |
string |
body |
No |
The ID of the parent comment. |
12345 |
|
patchset_biz_id |
string |
body |
Yes |
The ID of the associated patch set. If the comment type is INLINE_COMMENT, use either from_patchset_biz_id or to_patchset_biz_id. |
bf117304dfe44d5d9b1132f348edf92e |
|
resolved |
boolean |
body |
Yes |
Whether the comment is marked as resolved. |
false |
|
to_patchset_biz_id |
string |
body |
No |
The target patch set ID for comparison. Required for INLINE_COMMENT comments. |
bf117304dfe44d5d9b1132f348edf92e |
Request examples
Central edition
curl -X 'POST' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489or60de7a6852743a5162b5f957%2FDemoRepo/changeRequests/1/comments' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"comment_type": "GLOBAL_COMMENT,INLINE_COMMENT",
"content": "This is a comment content.",
"draft": true,
"file_path": "/src/main/java/com/example/MyClass.java",
"from_patchset_biz_id": "bf117304dfe44d5d9b1132f348edf92e",
"line_number": 42,
"parent_comment_biz_id": "12345",
"patchset_biz_id": "bf117304dfe44d5d9b1132f348edf92e",
"resolved": false,
"to_patchset_biz_id": "bf117304dfe44d5d9b1132f348edf92e"
}'
Region edition
curl -X 'POST' \
'https://{domain}/oapi/v1/codeup/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/changeRequests/1/comments' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"comment_type": "GLOBAL_COMMENT,INLINE_COMMENT",
"content": "This is a comment content.",
"draft": true,
"file_path": "/src/main/java/com/example/MyClass.java",
"from_patchset_biz_id": "bf117304dfe44d5d9b1132f348edf92e",
"line_number": 42,
"parent_comment_biz_id": "12345",
"patchset_biz_id": "bf117304dfe44d5d9b1132f348edf92e",
"resolved": false,
"to_patchset_biz_id": "bf117304dfe44d5d9b1132f348edf92e"
}'
Response parameters
|
Parameter |
Type |
Description |
Example |
| - |
object |
||
| author |
object |
The user information. |
|
|
avatar |
string |
The URL of the user's profile picture. |
https://example/example/w/100/h/100 |
|
|
string |
The email address of the user. |
username@example.com |
|
name |
string |
The user's name. |
codeup-name |
|
state |
string |
The user status. Valid values: active and blocked. |
active |
|
userId |
string |
Apsara DevOps user ID. |
62c795xxxb468af8 |
|
username |
string |
The logon name of the user. |
codeup-username |
| child_comments_list |
array |
The list of replies. |
[] |
| - |
object |
||
| author |
object |
The user information. |
|
|
avatar |
string |
The URL of the user's profile picture. |
https://example/example/w/100/h/100 |
|
|
string |
The email address of the user. |
username@example.com |
|
name |
string |
The user's name. |
codeup-name |
|
state |
string |
The user status. Valid values: active and blocked. |
active |
|
userId |
string |
The Apsara DevOps user ID. |
62c795xxxb468af8 |
|
username |
string |
The logon name of the user. |
codeup-username |
|
comment_biz_id |
string |
The business ID of the comment. |
bf117304dfe44d5d9b1132f348edf92e |
|
comment_time |
string |
The time the comment was created. |
2023-08-21T14:30:00Z |
|
comment_type |
string |
The type of the comment. |
INLINE_COMMENT |
|
content |
string |
The content of the comment. |
This is a comment content. |
| expression_reply_list |
array |
The list of emoji reactions. |
[] |
| - |
object |
||
|
emoji |
string |
The emoji. |
|
| reply_user_list |
array |
The list of users who reacted. |
|
| - |
object |
||
|
reply_biz_id |
string |
The business ID of the reply. |
1d8171cf0cc2453197fae0e0a27d5ece |
| reply_user |
object |
The user information. |
|
|
avatar |
string |
The URL of the user's profile picture. |
https://example/example/w/100/h/100 |
|
|
string |
The email address of the user. |
username@example.com |
|
name |
string |
The user's name. |
codeup-name |
|
state |
string |
The user status. Valid values: active and blocked. |
active |
|
userId |
string |
The Apsara Devops user ID. |
62c795xxxb468af8 |
|
username |
string |
The logon name of the user. |
codeup-username |
|
filePath |
string |
The file path. |
/src/main/java/com/example/MyClass.java |
|
from_patchset_biz_id |
string |
The source patch set ID. |
c341efc7fa38425eb575ad6ab6e95e76 |
|
is_deleted |
boolean |
Whether the comment is deleted. |
false |
|
last_edit_time |
string |
The time of the last modification. |
2023-08-21T15:00:00Z |
| last_edit_user |
object |
The user information. |
|
|
avatar |
string |
The URL of the user's profile picture. |
https://example/example/w/100/h/100 |
|
|
string |
The email address of the user. |
username@example.com |
|
name |
string |
The user's name. |
codeup-name |
|
state |
string |
The user status. Valid values: active and blocked. |
active |
|
userId |
string |
The Apsara DevOps user ID. |
62c795xxxb468af8 |
|
username |
string |
The logon name of the user. |
codeup-username |
|
last_resolved_status_change_time |
string |
The time the resolved status was last changed. |
2023-08-21T16:00:00Z |
| last_resolved_status_change_user |
object |
The user information. |
|
|
avatar |
string |
The URL of the user's profile picture. |
https://example/example/w/100/h/100 |
|
|
string |
The email address of the user. |
username@example.com |
|
name |
string |
The user's name. |
codeup-name |
|
state |
string |
The user status. Valid values: active and blocked. |
active |
|
userId |
string |
Apsara DevOps user ID. |
62c795xxxb468af8 |
|
username |
string |
The logon name of the user. |
codeup-username |
|
line_number |
integer |
The line number where the comment is located. |
42 |
| location |
object |
||
|
can_located |
boolean |
Whether the comment can be located. |
true |
|
located_file_path |
string |
The path of the located file. |
/src/main/java/com/example/Example.java |
|
located_line_number |
integer |
The line number of the location. |
100 |
|
located_patch_set_biz_id |
string |
The business ID of the located patch set. |
1d8171cf0cc2453197fae0e0a27d5ece |
|
mr_biz_id |
string |
The business ID of the merge request. |
bf117304dfe44d5d9b1132f348edf92e |
|
out_dated |
boolean |
Whether the comment is outdated. |
false |
|
parent_comment_biz_id |
string |
The business ID of the parent comment. |
1d8171cf0cc2453197fae0e0a27d5ece |
|
project_id |
integer |
The repository ID. |
123456 |
| related_patchset |
object |
||
|
commitId |
string |
The commit ID of the patch set. |
45ede4680536406d793e0e629bc771cb9fcaa153 |
|
createTime |
string |
The time when the patch set was created. |
2024-10-05T15:30:45Z |
|
patchSetBizId |
string |
The unique ID of the patch set. |
bf117304dfe44d5d9b1132f348edf92e |
|
patchSetName |
string |
The name of the version. |
Version 1 |
|
ref |
string |
The reference information of the patch set. |
null |
|
relatedMergeItemType |
string |
The type of the associated item. Valid values: MERGE_SOURCE and MERGE_TARGET. |
MERGE_SOURCE |
|
shortId |
string |
The short ID of the commit, which is typically 8 characters long. |
45ede468 |
|
versionNo |
integer |
The version number. |
1 |
|
resolved |
boolean |
Whether the comment is resolved. |
false |
|
root_comment_biz_id |
string |
The business ID of the root comment. |
1d8171cf0cc2453197fae0e0a27d5ece |
|
state |
string |
The status of the comment. |
OPENED,DRAFT |
|
to_patchset_biz_id |
string |
The target patch set ID. |
c341efc7fa38425eb575ad6ab6e95e76 |
|
comment_biz_id |
string |
The business ID of the comment. |
bf117304dfe44d5d9b1132f348edf92e |
|
comment_time |
string |
The time the comment was created. |
2023-08-21T14:30:00Z |
|
comment_type |
string |
The type of the comment. |
INLINE_COMMENT |
|
content |
string |
The content of the comment. |
This is a comment content. |
| expression_reply_list |
array |
The emoji reactions. |
[] |
| - |
object |
||
|
emoji |
string |
The emoji. |
|
| reply_user_list |
array |
The list of users who reacted. |
|
| - |
object |
||
|
reply_biz_id |
string |
The business ID of the reply. |
1d8171cf0cc2453197fae0e0a27d5ece |
| reply_user |
object |
The user information. |
|
|
avatar |
string |
The URL of the user's profile picture. |
https://example/example/w/100/h/100 |
|
|
string |
The email address of the user. |
username@example.com |
|
name |
string |
The user's name. |
codeup-name |
|
state |
string |
The user status. Valid values: active and blocked. |
active |
|
userId |
string |
The Apsara DevOps user ID. |
62c795xxxb468af8 |
|
username |
string |
The logon name of the user. |
codeup-username |
|
filePath |
string |
The file where the comment is located. |
/src/main/java/com/example/MyClass.java |
|
from_patchset_biz_id |
string |
The source patch set ID. |
c341efc7fa38425eb575ad6ab6e95e76 |
|
is_deleted |
boolean |
Whether the comment is deleted. |
false |
|
last_edit_time |
string |
The time the comment was last edited. |
2023-08-21T15:00:00Z |
| last_edit_user |
object |
The user information. |
|
|
avatar |
string |
The URL of the user's profile picture. |
https://example/example/w/100/h/100 |
|
|
string |
The email address of the user. |
username@example.com |
|
name |
string |
The user's name. |
codeup-name |
|
state |
string |
The user status. Valid values: active and blocked. |
active |
|
userId |
string |
The user ID for Apsara DevOps. |
62c795xxxb468af8 |
|
username |
string |
The logon name of the user. |
codeup-username |
|
last_resolved_status_change_time |
string |
The time the resolved status was last changed. |
2023-08-21T16:00:00Z |
| last_resolved_status_change_user |
object |
The user information. |
|
|
avatar |
string |
The URL of the user's profile picture. |
https://example/example/w/100/h/100 |
|
|
string |
The email address of the user. |
username@example.com |
|
name |
string |
The user's name. |
codeup-name |
|
state |
string |
The user status. Valid values: active and blocked. |
active |
|
userId |
string |
Apsara DevOps user ID. |
62c795xxxb468af8 |
|
username |
string |
The logon name of the user. |
codeup-username |
|
line_number |
integer |
The line number where the comment is located. |
42 |
| location |
object |
||
|
can_located |
boolean |
Whether the comment can be located. |
true |
|
located_file_path |
string |
The path of the located file. |
/src/main/java/com/example/Example.java |
|
located_line_number |
integer |
The line number of the location. |
100 |
|
located_patch_set_biz_id |
string |
The business ID of the located patch set. |
1d8171cf0cc2453197fae0e0a27d5ece |
|
mr_biz_id |
string |
The business ID of the associated merge request. |
bf117304dfe44d5d9b1132f348edf92e |
|
out_dated |
boolean |
Whether the comment is outdated. |
false |
|
parent_comment_biz_id |
string |
The business ID of the parent comment. |
1d8171cf0cc2453197fae0e0a27d5ece |
|
project_id |
integer |
The repository ID. |
123456 |
| related_patchset |
object |
||
|
commitId |
string |
The commit ID of the patch set. |
45ede4680536406d793e0e629bc771cb9fcaa153 |
|
createTime |
string |
The time when the patch set was created. |
2024-10-05T15:30:45Z |
|
patchSetBizId |
string |
The unique ID of the patch set. |
bf117304dfe44d5d9b1132f348edf92e |
|
patchSetName |
string |
The name of the patch set. |
Version 1 |
|
ref |
string |
The reference information of the patch set. |
null |
|
relatedMergeItemType |
string |
The type of the associated item. Valid values: MERGE_SOURCE and MERGE_TARGET. |
MERGE_SOURCE |
|
shortId |
string |
The short ID of the commit, which is typically 8 characters long. |
45ede468 |
|
versionNo |
integer |
The version number. |
1 |
|
resolved |
boolean |
Whether the comment is resolved. |
false |
|
root_comment_biz_id |
string |
The business ID of the root comment. |
1d8171cf0cc2453197fae0e0a27d5ece |
|
state |
string |
The status of the comment. |
OPENED,DRAFT |
|
to_patchset_biz_id |
string |
The target patch set ID. |
c341efc7fa38425eb575ad6ab6e95e76 |
Response example
{
"author": {
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"name": "codeup-name",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
},
"child_comments_list": [],
"comment_biz_id": "bf117304dfe44d5d9b1132f348edf92e",
"comment_time": "2023-08-21T14:30:00Z",
"comment_type": "INLINE_COMMENT",
"content": "This is a comment content.",
"expression_reply_list": [],
"filePath": "/src/main/java/com/example/MyClass.java",
"from_patchset_biz_id": "c341efc7fa38425eb575ad6ab6e95e76",
"is_deleted": false,
"last_edit_time": "2023-08-21T15:00:00Z",
"last_edit_user": {
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"name": "codeup-name",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
},
"last_resolved_status_change_time": "2023-08-21T16:00:00Z",
"last_resolved_status_change_user": {
"avatar": "https://example/example/w/100/h/100",
"email": "username@example.com",
"name": "codeup-name",
"state": "active",
"userId": "62c795xxxb468af8",
"username": "codeup-username"
},
"line_number": 42,
"location": {
"can_located": true,
"located_file_path": "/src/main/java/com/example/Example.java",
"located_line_number": 100,
"located_patch_set_biz_id": "1d8171cf0cc2453197fae0e0a27d5ece"
},
"mr_biz_id": "bf117304dfe44d5d9b1132f348edf92e",
"out_dated": false,
"parent_comment_biz_id": "1d8171cf0cc2453197fae0e0a27d5ece",
"project_id": 123456,
"related_patchset": {
"commitId": "45ede4680536406d793e0e629bc771cb9fcaa153",
"createTime": "2024-10-05T15:30:45Z",
"patchSetBizId": "bf117304dfe44d5d9b1132f348edf92e",
"patchSetName": "Version 1",
"ref": "null",
"relatedMergeItemType": "MERGE_SOURCE",
"shortId": "45ede468",
"versionNo": 1
},
"resolved": false,
"root_comment_biz_id": "1d8171cf0cc2453197fae0e0a27d5ece",
"state": "OPENED,DRAFT",
"to_patchset_biz_id": "c341efc7fa38425eb575ad6ab6e95e76"
}
Error codes
For more information, see Error Code Center.