Adding a Comment to a Work Item
Function
This API is used to add a comment to a work item.
Calling Method
For details, see Calling APIs.
Authorization Information
No identity policy-based permission required for calling this API.
URI
POST /v2/issues/update-issue-notes
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. Obtain a token by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Constraints N/A Range The value contains 10 to 32,768 characters. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | Yes | String | Definition: Work item ID, which can be obtained from the Performing Advanced Query of Work Items API. The value of the id field in the response message body is the work item ID. Constraints: The value must contain 1 to 10 digits. Value range: Minimum length: 1 character. Maximum length: 10 characters. Default value: N/A |
| notes | Yes | String | Definition: Comment on a work item. Constraints: N/A Value range: N/A Default value: N/A |
| project_uuid | Yes | String | Definition: 32-character UUID of a project, which uniquely identifies a project. Obtain the value of this parameter from the project_id field in the response body of the Querying the Project List API. Constraints: The value must contain 32 characters. Digits and letters are allowed. Value range: N/A Default value: N/A |
| type | No | String | Definition: Type of the project to which the work item belongs. Constraints: N/A Value range: Scrum Default value: N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| result | result object | Definition: Returned information. |
| status | String | Definition: Returned status. |
| Parameter | Type | Description |
|---|---|---|
| issue | IssueDetailResponseV2 object | Definition: Whether a custom status name is duplicate. Value range: true (duplicate) false (not duplicate) |
| Parameter | Type | Description |
|---|---|---|
| actual_work_hours | Double | Definition: Actual workloads of a work item (unit: person-hour). Value range: N/A |
| assigned_cc_user | Array of UserVO objects | Definition: Cc recipient of the current work item. |
| assigned_to | UserVO object | Definition: Current owner of a work item. |
| start_date | String | Definition: Estimated start time of a work item, in timestamp format, for example, 1754323200000. Value range: N/A |
| created_on | String | Definition: Time when a work item is created, in timestamp format, for example, 1754374102000. Value range: N/A |
| author | UserVO object | Definition: Work item creator. |
| custom_fields | Array of CustomFieldV2 objects | Definition: Custom field of a work item. |
| custom_value_new | IssueDetailCustomFieldV2 object | Definition: Custom field of a work item. |
| developer | UserVO object | Definition: Developer of a work item. |
| domain | domain object | Definition: Domain of a work item. |
| done_ratio | Integer | Definition: Work item completion rate. Value range: N/A |
| end_time | String | Definition: Estimated end time of a work item, in timestamp format, for example, 1754323200000. Value range: N/A |
| expected_work_hours | Double | Definition: Estimated completion time of a work item (unit: person-hour). Value range: N/A |
| id | Integer | Definition: Work item ID. Value range: N/A |
| project | ProjectVO object | Definition: Project to which the work item belongs. Value range: N/A |
| iteration | iteration object | Definition: Sprint to which the work item belongs. |
| story_point | story_point object | Definition: Story point information of a work item. |
| module | module object | Definition: Module of a work item. |
| subject | String | Definition: Title of a work item. Value range: N/A |
| parent_issue | parent_issue object | Definition: Parent work item of a work item. |
| priority | priority object | Definition: Work item priority. |
| severity | severity object | Definition: Work item severity. |
| status | status object | Definition: Current status of a work item. |
| release_dev | String | Definition: Release version of a work item. Value range: N/A |
| find_release_dev | String | Definition: Version where the bug was found (available only for bugs). Value range: N/A |
| env | env object | Definition: Environment where the bug was found (available only for bugs). |
| tracker | tracker object | Definition: Work item type. |
| updated_on | String | Definition: Last update time of a work item, in timestamp format, for example, 1754374102000. Value range: N/A |
| closed_time | String | Definition: Time when a work item is closed, in timestamp format, for example, 1754374102000. Value range: N/A |
| description | String | Definition: Work item description. Value range: N/A |
| accessories_list | Array of IssueAccessoryV2 objects | Definition: List of work item attachments. |
| inner_text | String | Definition: Updated comments on a work item. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| assigned_nick_name | String | Definition: User alias. Value range: N/A |
| first_name | String | Definition: Username. Value range: N/A |
| id | Integer | Definition: Digital ID of a user. Value range: N/A |
| identifier | String | Definition: 32–character UUID of a user. Value range: N/A |
| last_name | String | Definition: Last name of the user. Value range: N/A |
| name | String | Definition: Username with tenant information. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition: Custom field. Value range: N/A |
| value | String | Definition: Value of a custom field. Value range: N/A |
| new_name | String | Definition: Name of a custom field after modification. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| custom_field | String | Definition: Custom field. Value range: N/A |
| field_name | String | Definition: Custom field name. Value range: N/A |
| value | String | Definition: Values of custom properties, which are separated by commas (,). Value range: N/A |
| field_type | String | Definition: Custom field type. Value range: textArea: multi-line text text: single-line text select: drop-down list number: number time_date: date checkbox: check box radio: radio button |
| description | String | Definition: Description of a custom field. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Domain ID. Value range: N/A |
| name | String | Definition: Domain name. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| identifier | String | Definition: Project UUID. Value range: N/A |
| name | String | Definition: Project name. Value range: N/A |
| id | Integer | Definition: Digital ID of a project. Value range: N/A |
| project_type | String | Definition: Project type. Value range: Scrum |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Sprint ID of a work item. Value range: N/A |
| name | String | Definition: Sprint name of a work item. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Story point ID of a work item. Value range: N/A |
| name | String | Definition: Story point name of a work item. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Module ID of a work item. Value range: N/A |
| name | String | Definition: Module name of a work item. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Parent work item ID of a work item. Value range: N/A |
| name | String | Definition: Parent work item name of a work item. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Priority ID of a work item. Value range: N/A |
| name | String | Definition: Priority name of a work item. Value range: High, Medium, and Low |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Work item severity ID. Value range: N/A |
| name | String | Definition: Work item severity name. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Current status ID of a work item. Value range: N/A |
| name | String | Definition: Current status of a work item. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: ID of the environment where the bug was found. Value range: N/A |
| name | String | Definition: Name of the environment where the bug was found. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition: Type ID of a work item. Value range: 2, 3, 5, 6, and 7 |
| name | String | Definition: Work item type name. Value range: 2 (task) 3 (bug) 5 (epic) 6 (feature) 7 (story) |
| Parameter | Type | Description |
|---|---|---|
| attachment_id | Integer | Definition: Attachment ID. Value range: N/A |
| issue_id | Integer | Definition: Digital ID of a work item. Value range: N/A |
| creator_num_id | Integer | Definition: Digital ID of the attachment uploader. Value range: N/A |
| created_date | String | Definition: Attachment creation time, for example, 2025-08-04 19:43:46. Value range: N/A |
| file_name | String | Definition: Attachment name. Value range: N/A |
| container_type | String | Definition: Attachment type. Value range: Scrum |
| disk_file_name | String | Definition: Actual name of the attachment on the server. Value range: N/A |
| digest | String | Definition: Attachment source. Value range: 1 (local document uploaded for a work item) and 2 (associated document) |
| disk_directory | String | Definition: Path of the attachment on the server. Value range: N/A |
| creator_id | String | Definition: UUID of the attachment uploader. Value range: N/A |
Example Requests
POST http://{endpoint}/v2/issues/update-issue-notes
{
"id" : 9206017,
"notes" : "TEST",
"project_uuid" : "a8ac165097ff4e42bcfb234dd27d30a6",
"type" : "scrum"
} Example Responses
Status code: 200
{
"result" : {
"issue" : {
"id" : 2884419,
"subject" : "TEST",
"author" : {
"first_name" : "xxxxxx",
"last_name" : "xxxxxx",
"identifier" : "xxxxxx",
"name" : "xxxxxx",
"id" : 1111,
"assigned_nick_name" : "xxxxxx"
},
"created_on" : "1754463933000",
"updated_on" : "1754463933000",
"done_ratio" : 0,
"description" : "<p><strong>TEST</strong></p>",
"expected_work_hours" : 0,
"actual_work_hours" : 0,
"release_dev" : "",
"project" : {
"identifier" : "310eed4d6160446cb294a8bacfd46e7e",
"name" : "APIFunction202507Cukr9K",
"id" : 6345282
},
"tracker" : {
"name" : "Story",
"id" : 7
},
"status" : {
"name" : "New",
"id" : 1
},
"assigned_to" : {
"first_name" : "xxxxxx",
"last_name" : "xxxxxx",
"identifier" : "xxxxxx",
"name" : "xxxxxx",
"id" : 1111,
"assigned_nick_name" : "xxxxxx"
},
"developer" : { },
"priority" : {
"name" : "Medium",
"id" : 2
},
"severity" : {
"name" : "Minor",
"id" : 12
},
"module" : { },
"story_point" : {
"id" : 3,
"name" : "1"
},
"assigned_cc_user" : [ ],
"inner_text" : "TEST1"
}
},
"status" : "success"
} SDK Sample Code
The SDK sample code is as follows.
Java
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 | 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 UpdateScrumIssueNotesSolution { 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(); UpdateScrumIssueNotesRequest request = new UpdateScrumIssueNotesRequest(); AddCommentsRequest body = new AddCommentsRequest(); body.withType("scrum"); body.withNotes("TEST"); body.withId("9206017"); request.withBody(body); try { UpdateScrumIssueNotesResponse response = client.updateScrumIssueNotes(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
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 | # 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 = UpdateScrumIssueNotesRequest() request.body = AddCommentsRequest( type="scrum", notes="TEST", id="9206017" ) response = client.update_scrum_issue_notes(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
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 | 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.UpdateScrumIssueNotesRequest{} typeAddCommentsRequest:= "scrum" request.Body = &model.AddCommentsRequest{ Type: &typeAddCommentsRequest, Notes: "TEST", Id: "9206017", } response, err := client.UpdateScrumIssueNotes(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 to a successful request for adding a comment to a work item. |
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