# 工作项添加评论 - UpdateScrumIssueNotes
#### 功能介绍
工作项添加评论。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-projectman/projectman_api_1002.html)。
#### 授权信息
当前API调用无需身份策略权限。
#### URI
POST /v2/issues/update-issue-notes
#### 请求参数
表1请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释：** 用户Token。 通过调用IAM服务[获取用户Token](https://support.huaweicloud.com/api-iam/iam_30_0001.html)接口获取（响应消息头中X-Subject-Token的值）。 **约束限制：** 不涉及。 **取值范围：** 长度为10\~32768个字符。 **默认取值：** 不涉及。 |
   
表2请求Body参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|:---|:---|:---|:---|
| id           | 是    | String | **参数解释：** 工作项id，可通过[高级查询工作项](https://support.huaweicloud.com/api-projectman/ListIssuesV4.html)接口获取，响应消息体中的**id**字段的值就是工作项id。 **约束限制：** 长度在1位到10位之间的纯数字。 **取值范围：** 最小长度：1，最大长度：10。 **默认取值：** 不涉及。        |
| notes        | 是    | String | **参数解释：** 工作项的评论内容。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。                                                                                                                                        |
| project_uuid | 是    | String | **参数解释**： 项目的32位uuid，项目唯一标识，通过[查询项目列表](https://support.huaweicloud.com/api-projectman/ListProjectsV4.html)接口获取，响应消息体中的**project_id**字段的值就是项目ID。 **约束限制**： 由数字和英文组成的32字符串。 **取值范围**： 不涉及。 **默认取值**： 不涉及。 |
| type         | 否    | String | **参数解释**： 工作项所属项目类型。 **约束限制**： 不涉及。 **取值范围**： scrum。 **默认取值**： 不涉及。                                                                                                                                     |
   
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数     | 参数类型                                                     | 描述                                                       |
|:---|:---|:---|
| result | [result] object | **参数解释：** 返回信息。 |
| status | String                                                   | **参数解释：** 返回状态。 |
   
 表4result 
| 参数    | 参数类型                                                                                   | 描述                                                                                                                                                                                                                       |
|:---|:---|:---|
| issue | [IssueDetailResponseV2] object | **参数解释：** 自定义状态名称是否重复。 **取值范围：** true(重复) false(不重复) |
   
 表5IssueDetailResponseV2 
| 参数                  | 参数类型                                                                                         | 描述                                                                                                                                                                                      |
|:---|:---|:---|
| actual_work_hours   | Double                                                                                       | **参数解释：** 工作项的实际工时（单位：人/时）。 **取值范围：** 不涉及。                   |
| assigned_cc_user    | Array of [UserVO] objects                           | **参数解释：** 当前工作项的抄送人。                                                                                                                           |
| assigned_to         | [UserVO] object                                     | **参数解释：** 工作项的当前责任人。                                                                                                                           |
| start_date          | String                                                                                       | **参数解释：** 工作项的预计开始时间，时间戳格式（示例：1754323200000）。 **取值范围：** 不涉及。 |
| created_on          | String                                                                                       | **参数解释：** 工作项创建时间，时间戳格式（示例：1754374102000）。 **取值范围：** 不涉及。    |
| author              | [UserVO] object                                     | **参数解释：** 工作项的创建人。                                                                                                                             |
| custom_fields       | Array of [CustomFieldV2] objects             | **参数解释：** 工作项的自定义字段。                                                                                                                           |
| custom_value_new    | [IssueDetailCustomFieldV2] object | **参数解释：** 工作项的自定义字段。                                                                                                                           |
| developer           | [UserVO] object                                     | **参数解释：** 工作项的开发人员。                                                                                                                            |
| domain              | [domain] object                                     | **参数解释：** 工作项的领域信息。                                                                                                                            |
| done_ratio          | Integer                                                                                      | **参数解释：** 工作项完成度。 **取值范围：** 不涉及。                             |
| end_time            | String                                                                                       | **参数解释：** 工作项的预计结束时间，时间戳格式（示例：1754323200000）。 **取值范围：** 不涉及。 |
| expected_work_hours | Double                                                                                       | **参数解释：** 工作项的预计完成工时（单位：人/时）。 **取值范围：** 不涉及。                 |
| id                  | Integer                                                                                      | **参数解释：** 工作项id。 **取值范围：** 不涉及。                              |
| project             | [ProjectVO] object                               | **参数解释：** 工作项所属项目信息。 **取值范围：** 不涉及。                          |
| iteration           | [iteration] object                               | **参数解释：** 工作项所属迭代信息。                                                                                                                           |
| story_point         | [story_point] object                           | **参数解释：** 工作项的故事点信息。                                                                                                                           |
| module              | [module] object                                     | **参数解释：** 工作项的模块信息。                                                                                                                            |
| subject             | String                                                                                       | **参数解释：** 工作项的标题。 **取值范围：** 不涉及。                             |
| parent_issue        | [parent_issue] object                         | **参数解释：** 工作项的父工作项信息。                                                                                                                          |
| priority            | [priority] object                                 | **参数解释：** 工作项的优先级。                                                                                                                             |
| severity            | [severity] object                                 | **参数解释：** 工作项的重要程度。                                                                                                                            |
| status              | [status] object                                     | **参数解释：** 工作项的当前状态。                                                                                                                            |
| release_dev         | String                                                                                       | **参数解释：** 工作项发布版本号。 **取值范围：** 不涉及。                           |
| find_release_dev    | String                                                                                       | **参数解释：** 缺陷发现版本号（仅Bug类型工作项具备该字段）。 **取值范围：** 不涉及。            |
| env                 | [env] object                                           | **参数解释：** 缺陷发现环境（仅Bug类型工作项具备该字段）。                                                                                                              |
| tracker             | [tracker] object                                   | **参数解释：** 工作项类型。                                                                                                                               |
| updated_on          | String                                                                                       | **参数解释：** 工作项的最后更新时间，时间戳格式（示例：1754374102000）。 **取值范围：** 不涉及。 |
| closed_time         | String                                                                                       | **参数解释：** 工作项的关闭时间，时间戳格式（示例：1754374102000）。 **取值范围：** 不涉及。   |
| description         | String                                                                                       | **参数解释：** 工作项描述。 **取值范围：** 不涉及。                              |
| accessories_list    | Array of [IssueAccessoryV2] objects       | **参数解释：** 工作项的附件列表。                                                                                                                            |
| inner_text          | String                                                                                       | **参数解释：** 工作项更新的评论内容。 **取值范围：** 不涉及。                         |
   
 表6UserVO 
| 参数                 | 参数类型    | 描述                                                                                                                                                              |
|:---|:---|:---|
| assigned_nick_name | String  | **参数解释：** 用户的昵称。 **取值范围：** 不涉及。      |
| first_name         | String  | **参数解释：** 用户名。 **取值范围：** 不涉及。        |
| id                 | Integer | **参数解释：** 用户的数字id。 **取值范围：** 不涉及。    |
| identifier         | String  | **参数解释：** 用户的32位uuid。 **取值范围：** 不涉及。 |
| last_name          | String  | **参数解释：** 用户姓名。 **取值范围：** 不涉及。       |
| name               | String  | **参数解释：** 有租户信息的用户名。 **取值范围：** 不涉及。  |
   
 表7CustomFieldV2 
| 参数       | 参数类型   | 描述                                                                                                                                                               |
|:---|:---|:---|
| name     | String | **参数解释：** 自定义字段。 **取值范围：** 不涉及。       |
| value    | String | **参数解释：** 自定义字段对应的值。 **取值范围：** 不涉及。   |
| new_name | String | **参数解释：** 自定义字段修改后的名称。 **取值范围：** 不涉及。 |
   
 表8IssueDetailCustomFieldV2 
| 参数           | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|
| custom_field | String | **参数解释：** 自定义字段。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                                      |
| field_name   | String | **参数解释：** 自定义字段名称。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                                    |
| value        | String | **参数解释：** 自定义属性对应的值，多个值以英文逗号区分开。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                      |
| field_type   | String | **参数解释：** 自定义字段类型。 **取值范围：** textArea 多行文本 text 单行文本 select 下拉框 number 数字 time_date 日期 checkbox 多选框 radio 单选框。 |
| description  | String | **参数解释：** 自定义字段描述。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                                    |
   
 表9domain 
| 参数   | 参数类型    | 描述                                                                                                                                                        |
|:---|:---|:---|
| id   | Integer | **参数解释：** 领域id。 **取值范围：** 不涉及。 |
| name | String  | **参数解释：** 领域名称。 **取值范围：** 不涉及。 |
   
 表10ProjectVO 
| 参数           | 参数类型    | 描述                                                                                                                                                         |
|:---|:---|:---|
| identifier   | String  | **参数解释：** 项目uuid **取值范围：** 不涉及。 |
| name         | String  | **参数解释：** 项目名称 **取值范围：** 不涉及。   |
| id           | Integer | **参数解释：** 项目数字id **取值范围：** 不涉及。 |
| project_type | String  | **参数解释：** 项目类型 **取值范围：** scrum。 |
   
 表11iteration 
| 参数   | 参数类型    | 描述                                                                                                                                                            |
|:---|:---|:---|
| id   | Integer | **参数解释：** 工作项的迭代id。 **取值范围：** 不涉及。 |
| name | String  | **参数解释：** 工作项的迭代名称。 **取值范围：** 不涉及。 |
   
 表12story_point 
| 参数   | 参数类型    | 描述                                                                                                                                                             |
|:---|:---|:---|
| id   | Integer | **参数解释：** 工作项的故事点id。 **取值范围：** 不涉及。 |
| name | String  | **参数解释：** 工作项的故事点名称。 **取值范围：** 不涉及。 |
   
 表13module 
| 参数   | 参数类型    | 描述                                                                                                                                                            |
|:---|:---|:---|
| id   | Integer | **参数解释：** 工作项的模块id。 **取值范围：** 不涉及。 |
| name | String  | **参数解释：** 工作项的模块名称。 **取值范围：** 不涉及。 |
   
 表14parent_issue 
| 参数   | 参数类型    | 描述                                                                                                                                                              |
|:---|:---|:---|
| id   | Integer | **参数解释：** 工作项的父工作项id。 **取值范围：** 不涉及。 |
| name | String  | **参数解释：** 工作项的父工作项名称。 **取值范围：** 不涉及。 |
   
 表15priority 
| 参数   | 参数类型    | 描述                                                                                                                                                               |
|:---|:---|:---|
| id   | Integer | **参数解释：** 工作项的优先级id。 **取值范围：** 不涉及。   |
| name | String  | **参数解释：** 工作项的优先级名称。 **取值范围：** 高，中，低。 |
   
 表16severity 
| 参数   | 参数类型    | 描述                                                                                                                                                              |
|:---|:---|:---|
| id   | Integer | **参数解释：** 工作项的重要程度id。 **取值范围：** 不涉及。 |
| name | String  | **参数解释：** 工作项的重要程度名称。 **取值范围：** 不涉及。 |
   
 表17status 
| 参数   | 参数类型    | 描述                                                                                                                                                              |
|:---|:---|:---|
| id   | Integer | **参数解释：** 工作项的当前状态id。 **取值范围：** 不涉及。 |
| name | String  | **参数解释：** 工作项的当前状态名称。 **取值范围：** 不涉及。 |
   
 表18env 
| 参数   | 参数类型    | 描述                                                                                                                                                            |
|:---|:---|:---|
| id   | Integer | **参数解释：** 缺陷发现环境id。 **取值范围：** 不涉及。 |
| name | String  | **参数解释：** 缺陷发现环境名称。 **取值范围：** 不涉及。 |
   
 表19tracker 
| 参数   | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                        |
|:---|:---|:---|
| id   | Integer | **参数解释：** 工作项的类型id。 **取值范围：** 2，3，5，6，7。                                                                                                                                                                                                       |
| name | String  | **参数解释：** 工作项的类型名称。 **取值范围：** 2：任务/Task 3：缺陷/Bug 5：Epic 6：Feature 7：Story。 |
   
 表20IssueAccessoryV2 
| 参数             | 参数类型    | 描述                                                                                                                                                                                  |
|:---|:---|:---|
| attachment_id  | Integer | **参数解释：** 附件id。 **取值范围：** 不涉及。                           |
| issue_id       | Integer | **参数解释：** 工作项数字id。 **取值范围：** 不涉及。                        |
| creator_num_id | Integer | **参数解释：** 附件的上传者数字ID。 **取值范围：** 不涉及。                     |
| created_date   | String  | **参数解释：** 附件创建时间（示例：2025-08-04 19:43:46）。 **取值范围：** 不涉及。 |
| file_name      | String  | **参数解释：** 附件名称。 **取值范围：** 不涉及。                           |
| container_type | String  | **参数解释：** 附件所属类型。 **取值范围：** scrum。                       |
| disk_file_name | String  | **参数解释：** 附件在服务器上实际名称。 **取值范围：** 不涉及。                    |
| digest         | String  | **参数解释：** 附件来源。 **取值范围：** 1：工作项本地上传的文档；2：关联的文档。          |
| disk_directory | String  | **参数解释：** 附件在服务器上的路径。 **取值范围：** 不涉及。                     |
| creator_id     | String  | **参数解释：** 附件的上传者uuid。 **取值范围：** 不涉及。                     |
   
#### 请求示例
```
POST http://{endpoint}/v2/issues/update-issue-notes
{
  "id" : 9206017,
  "notes" : "TEST",
  "project_uuid" : "a8ac165097ff4e42bcfb234dd27d30a6",
  "type" : "scrum"
}
```
#### 响应示例
**状态码：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" : "新建",
        "id" : 1
      },
      "assigned_to" : {
        "first_name" : "xxxxxx",
        "last_name" : "xxxxxx",
        "identifier" : "xxxxxx",
        "name" : "xxxxxx",
        "id" : 1111,
        "assigned_nick_name" : "xxxxxx"
      },
      "developer" : { },
      "priority" : {
        "name" : "中",
        "id" : 2
      },
      "severity" : {
        "name" : "一般",
        "id" : 12
      },
      "module" : { },
      "story_point" : {
        "id" : 3,
        "name" : "1"
      },
      "assigned_cc_user" : [ ],
      "inner_text" : "TEST1"
    }
  },
  "status" : "success"
}
```
#### SDK代码示例
SDK代码示例如下。
#### Java
```
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
```
# 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
```
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)
    }
}
```
#### 更多
更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/ProjectMan/sdk?api=UpdateScrumIssueNotes)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述              |
|:---|:---|
| 200 | 工作项添加评论接口成功的响应。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-projectman/ErrorCode.html)。
