Modifying a Work Item Comment
Function
This API is used to modify the content of a specified comment under a work item. Only the comment body and the list of @mentioned users can be modified. Mentioned users will be notified.
Calling Method
For details, see Calling APIs.
Authorization Information
No identity policy-based permission required for calling this API.
URI
PUT /v1/ipdprojectservice/projects/{project_id}/issues/{issue_id}/comments/{comment_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition 32-character ID of a project, which must be unique. Obtain the value by calling the API for querying the IPD project list. The value of id in the response message body is the project ID. Constraints N/A Range A string of 32 characters consisting of letters and digits. Default Value N/A |
| issue_id | Yes | String | Definition Unique ID of a work item. You can obtain the value from the Querying Work Items or Querying Tree-shaped Work Items API. The value is id in the response body. Constraints N/A Range A string of 18 to 19 digits. Default Value N/A |
| comment_id | Yes | String | Definition Comment ID, which uniquely identifies a comment. It can be obtained by calling the Querying Work Item Comments API. The value of the result.comment_list.id field in the response body is the comment ID. Constraints N/A Range A numeric string of 18 to 19 characters. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| description | No | String | Definition Modified comment content, described in HTML markup language with support for rich text (including text, @mentions, images, and other elements). Constraints 1 to 10,000 characters. Range N/A Default Value N/A |
| at_others | No | String | Definition List of user IDs @mentioned in the comment, separated by commas (,). After this parameter is specified, the system notifies the mentioned users. The notification mode can be configured in Req > Settings > Work Item > Notifications. Constraints Each user ID contains 32 characters. Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition Response status of the comment operation, used to indicate whether the API call is successful. Range |
| message | String | Definition Response message of the comment operation. The error message is returned when an API call fails. |
| result | CommentEntity object | Definition Comment operation result, including the comment ID, content, creator, creation time, and other complete comment attributes. When deleting a comment, only key fields such as the comment ID, pin status, and last modifier are returned. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Comment ID, which uniquely identifies a comment. Range A numeric string of 18 to 19 characters. |
| category | String | Definition Comment type, which distinguishes between user-created comments, reply comments, and system-generated key operation comments. Range |
| type | String | Definition Comment metadata type, used by the frontend to distinguish the rendering format of comments. Range Fixed at comment. |
| top | Boolean | Definition Whether to display the comment in the pinned area. Range |
| top_time | String | Definition Unix timestamp of the pin time, in milliseconds. When there are multiple pinned comments, the most recently pinned comment is displayed at the top. Range A numeric string of 10 to 19 characters. |
| description | String | Definition Comment content, described using HTML tags with support for rich text (including text, @mentions, images, and other elements). Range 1 to 10,000 characters. |
| issue_id | String | Definition ID of the work item to which the comment belongs. It can be obtained by calling the Querying the Work Item List API. The value of the id field in the response body is the work item ID. Range A numeric string of 18 to 19 characters. |
| top_flag | Boolean | Definition Whether the current comment is pinned. Range |
| created_by | String | Definition Comment creator ID. Range 32 characters. |
| modified_by | String | Definition Last modifier ID of the comment. Range 32 characters. |
| created_date | String | Definition Unix timestamp of the comment creation time, in milliseconds. Range A numeric string of 10 to 19 characters. |
| modified_date | String | Definition Unix timestamp of the last modification time of the comment, in milliseconds. Range A numeric string of 10 to 19 characters. |
| creator_info | UserVO object | Definition Detailed information of the comment creator, including the user ID, username, nickname, tenant ID, role, and other attributes. |
| extend_attribute | String | Definition Extended attributes of the comment, expressed as a JSON string, mainly used to describe the operation information associated with system-generated comments (such as status transitions and field changes). Only system comments (category: operation) have this value. Range 0 to 10,000 characters. |
| extend_attribute_obj | CommentExtendAttribute object | Definition Extended attribute object of the comment, containing structured information such as the operator, operation action, and values before and after status transitions. Only system comments (category: operation) have this value. |
| extend_attribute_objs | Array of CommentExtendAttribute objects | Definition Array of extended attribute objects for comments, containing structured information for multiple extended operations. Only system comments (category: operation) have this value. |
| Parameter | Type | Description |
|---|---|---|
| operator | UserVO object | Definition Operator user information, including the user ID, username, tenant ID, role, and other attributes. |
| operator_id | String | Definition Operator ID. Range 32 characters. |
| action | String | Definition Chinese description of the action performed when the system generates a comment, such as saving the initial requirement or modifying the status. Range N/A |
| action_us | String | Definition English description of the action performed when the system generates a comment, with the same meaning as the action field, used for internationalization scenarios. Range N/A |
| object_type | String | Definition Object type corresponding to the system-generated comment, used to identify the dimension of the object affected by this operation, such as the status field or owner field. Range N/A |
| pre_status_code | String | Definition Status code of the work item before transition, used to identify the previous status of the work item before this operation. Range N/A |
| new_status_code | String | Definition Status code of the work item after transition, used to identify the latest status of the work item after this operation. Range N/A |
| pre_status | Object | Definition Field value of the work item before transition. The object type varies depending on the field_type_id value. |
| new_status | Object | Definition Field value of the work item after transition. The object type varies depending on the field_type_id value. |
| field_type | String | Definition Field type enumeration value, used together with field_type_id to identify the field type affected by this operation, such as STATUS. Range N/A |
| field_type_id | String | Definition ID corresponding to the field type, used together with field_type. For common values and corresponding field value types, see the pre_status/new_status field description. Range N/A |
| display_name | String | Definition Field display name, used to identify the name of the field affected by this operation in the UI, such as status and owner. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| user_id | String | Definition User ID. Range N/A |
| user_num_id | Integer | Definition Short ID of a user. Range N/A |
| user_name | String | Definition Username. Range N/A |
| domain_id | String | Definition ID of the domain to which the user belongs. Range N/A |
| domain_name | String | Definition Tenant name. Range N/A |
| nick_name | String | Definition User alias. Range N/A |
| role_id | String | Definition Role ID. If a user has multiple roles in a project, use commas (,) to separate the values. Range N/A |
| role_name | String | Definition Role name. If a user has multiple roles, use commas (,) to separate the values. Range N/A |
| role_code | String | Definition Role code. If a user has multiple roles, use commas (,) to separate the values. Range N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error description, which is a supplement to error_code. Range N/A |
Example Requests
Modify comment 1013376662760370177 under work item 1013376545030451200 in project 7493564f7c044511861d2a1deba53806.
PUT https://{endpoint}/v1/ipdprojectservice/projects/7493564f7c044511861d2a1deba53806/issues/1013376545030451200/comments/1013376662760370177
{
"description" : "<p>Another reply 21112.</p>"
} Example Responses
Status code: 200
{
"status" : "success",
"message" : "",
"result" : {
"id" : "1225551336203448321",
"category" : "Reply",
"type" : "comment",
"top" : false,
"description" : "<p>1111</p><p><span class=\"ql-mention-link\" title=\"ForTest\" mentionchar=\"@\">\uFEFF<span contenteditable=\"false\">@ForTest</span>\uFEFF</span></p><p><img src=\"/api/ipdproject/openapi/v1/projects/2f4e18b0bcf34331acbc23c8692266b3/imgs/f75136f467924a7bbb99f13b7a2428a8.png\" style=\"vertical-align: baseline;\"></p>",
"at" : "c2d89e38a64a466f8f945f595df4402d",
"issue_id" : "1225113610320470016",
"parent_id" : "1225498465597218817",
"root_id" : "1225498465597218817",
"top_flag" : false,
"created_by" : "c2d89e38a64a466f8f945f595df4402d",
"created_date" : "1770123808193",
"creator_info" : {
"user_id" : "c2d89e38a64a466f8f945f595df4402d",
"user_num_id" : null,
"user_name" : "ForTest",
"domain_id" : "aae03ca0d6814951980945b6eeca56cd",
"domain_name" : null,
"nick_name" : "ForTest",
"role_id" : "92888e959cf544a1b220b6601b6e5402,078d8048707f4aa9a2f8b064cae589e9",
"role_name" : "Project manager, project administrator.",
"role_code" : "Project manager,project_admin"
}
}
} Status code: 400
{
"error_code" : "PM.02174103",
"error_msg" : "No permission."
} SDK Sample Code
The SDK sample code is as follows.
Java
Modify comment 1013376662760370177 under work item 1013376545030451200 in project 7493564f7c044511861d2a1deba53806.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.projectman.v4.region.ProjectManRegion; import com.huaweicloud.sdk.projectman.v4.*; import com.huaweicloud.sdk.projectman.v4.model.*; public class UpdateIpdIssueCommentSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); ProjectManClient client = ProjectManClient.newBuilder() .withCredential(auth) .withRegion(ProjectManRegion.valueOf("<YOUR REGION>")) .build(); UpdateIpdIssueCommentRequest request = new UpdateIpdIssueCommentRequest(); request.withCommentId("{comment_id}"); request.withProjectId("{project_id}"); request.withIssueId("{issue_id}"); CommentUpdateVO body = new CommentUpdateVO(); body.withDescription("<p>Another reply 21112.</p>"); request.withBody(body); try { UpdateIpdIssueCommentResponse response = client.updateIpdIssueComment(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
Modify comment 1013376662760370177 under work item 1013376545030451200 in project 7493564f7c044511861d2a1deba53806.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkprojectman.v4.region.projectman_region import ProjectManRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkprojectman.v4 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = BasicCredentials(ak, sk) client = ProjectManClient.new_builder() \ .with_credentials(credentials) \ .with_region(ProjectManRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateIpdIssueCommentRequest() request.comment_id = "{comment_id}" request.project_id = "{project_id}" request.issue_id = "{issue_id}" request.body = CommentUpdateVO( description="<p>Another reply 21112.</p>" ) response = client.update_ipd_issue_comment(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
Modify comment 1013376662760370177 under work item 1013376545030451200 in project 7493564f7c044511861d2a1deba53806.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" projectman "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := projectman.ProjectManClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := projectman.NewProjectManClient(hcClient) request := &model.UpdateIpdIssueCommentRequest{} request.CommentId = "{comment_id}" request.ProjectId = "{project_id}" request.IssueId = "{issue_id}" descriptionCommentUpdateVo:= "<p>Another reply 21112.</p>" request.Body = &model.CommentUpdateVo{ Description: &descriptionCommentUpdateVo, } response, err := client.UpdateIpdIssueComment(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | Response for a successful modification. |
| 400 | Response upon a request failure. For example, the user does not have the operation permission or the project does not exist. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank 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