# 创建工作项评论 - CreateIpdIssueComments
#### 功能介绍
为指定工作项创建新的评论或回复评论。创建评论时传入**category** 为*comment* ；回复已有评论时传入**category** 为*reply* 并填写**parent_id** 和**root_id**，被@的用户将收到通知。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-projectman/projectman_api_1002.html)。
#### 授权信息
当前API调用无需身份策略权限。
#### URI
POST /v1/ipdprojectservice/projects/{project_id}/issues/{issue_id}/comments
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| project_id | 是    | String | **参数解释**： 项目32位ID，项目唯一标识。通过[查询IPD项目列表](https://support.huaweicloud.com/api-projectman/ShowIpdProjectList.html)获取，响应消息体中的**id**字段的值就是项目ID。 **约束限制**： 不涉及。 **取值范围**： 32个字符，由英文字母和数字组成。 **默认取值**： 不涉及。                                                                               |
| issue_id   | 是    | String | **参数解释**： 工作项唯一ID。可以通过[查询工作项列表](https://support.huaweicloud.com/api-projectman/ListIpdProjectIssues.html)或者[查询树状工作项](https://support.huaweicloud.com/api-projectman/ShowIpdIssueTree.html)接口获取，响应消息体中的**id**字段的值就是工作项ID。 **约束限制**： 不涉及。 **取值范围**： 18\~19个字符的数字字符串。 **默认取值**： 不涉及。 |
   
#### 请求参数
表2请求Body参数 
| 参数             | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| category       | 否    | String | **参数解释**： 评论类型，区分新建评论与回复评论，系统操作类型的评论不支持通过此接口创建。 **约束限制**： 不涉及。 **取值范围**： - comment：新建文字评论。   - reply：回复他人评论。   - operation：系统操作（不支持通过此接口创建）。    **默认取值**： 不涉及。 |
| issue_category | 否    | String | **参数解释**： 评论所属工作项的类型，例如IR、SR、AR等。该字段用于标识评论归属的工作项分类，决定评论展示与通知的业务逻辑。 **约束限制**： 不涉及。 **取值范围**： IR、SR、AR、RR、US、Task、Bug等IPD工作项类型。 **默认取值**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| description    | 否    | String | **参数解释**： 评论内容，使用HTML标记语言描述，支持富文本（包含文本、@提及、图片等元素）。 **约束限制**： 1\~10000个字符。 **取值范围**： 不涉及。 **默认取值**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| parent_id      | 否    | String | **参数解释**： 评论的父ID，取值为需要回复的评论的ID。 **约束限制**： 回复评论时必填。 **取值范围**： 18\~19个字符的数字字符串。 **默认取值**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| root_id        | 否    | String | **参数解释**： 评论的根ID，取值为被回复的最顶层评论的ID，用于构建评论楼中楼的层级关系。 **约束限制**： 回复评论时必填，创建评论时不能填。 **取值范围**： 18\~19个字符的数字字符串。 **默认取值**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| at_others      | 否    | String | **参数解释**： 评论中@他人的用户ID列表，使用英文逗号分隔多个用户ID。填写此参数后系统会通知被@的用户，通知形式在需求管理\>设置\>工作项设置\>通知设置中配置。 **约束限制**： 每个用户ID为32个字符。 **取值范围**： 不涉及。 **默认取值**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
   
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数      | 参数类型                                                                    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|
| status  | String                                                                  | **参数解释**： 评论操作的响应状态，用于标识接口调用是否成功。 **取值范围**： - success：评论操作成功。   - error：评论操作失败。    |
| message | String                                                                  | **参数解释**： 评论操作的响应信息，当接口调用异常时返回对应的错误描述。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| result  | [CommentEntity] object | **参数解释**： 评论操作的返回结果，包含评论ID、评论内容、创建人、创建时间等完整评论属性。删除评论时仅返回评论ID、置顶状态、最近修改人等关键字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
   
 表4CommentEntity 
| 参数                    | 参数类型                                                                                                | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|
| id                    | String                                                                                              | **参数解释**： 评论ID，评论唯一标识。 **取值范围**： 18\~19个字符的数字字符串。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| category              | String                                                                                              | **参数解释**： 评论类型，区分用户创建评论、回复评论与系统自动生成的关键操作评论。 **取值范围**： - comment：用户创建的文字评论。   - reply：用户回复他人的评论。   - operation：系统根据关键操作自动生成的评论，例如状态流转、字段变更等。    |
| type                  | String                                                                                              | **参数解释**： 评论元数据类型，用于前端区分评论渲染形式。 **取值范围**： 固定为 comment。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| top                   | Boolean                                                                                             | **参数解释**： 是否显示在评论置顶区域。 **取值范围**： - true：显示在置顶区域。   - false：不显示在置顶区域。                                                                                                                                                                                                                                                                     |
| top_time              | String                                                                                              | **参数解释**： 置顶时间的unix时间戳，单位：毫秒。当有多条置顶评论时，最后置顶的评论显示在最上层。 **取值范围**： 10\~19个字符的数字字符串。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| description           | String                                                                                              | **参数解释**： 评论内容，使用HTML标签描述，支持富文本（包含文本、@提及、图片等元素）。 **取值范围**： 1\~10000个字符。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| issue_id              | String                                                                                              | **参数解释**： 评论所属工作项ID。可通过[查询工作项列表](https://support.huaweicloud.com/api-projectman/ListIpdProjectIssues.html)接口获取，响应消息体中的**id**字段的值就是工作项ID。 **取值范围**： 18\~19个字符的数字字符串。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| top_flag              | Boolean                                                                                             | **参数解释**： 当前评论是否被置顶。 **取值范围**： - true：已置顶。   - false：未置顶。                                                                                                                                                                                                                                                                                |
| created_by            | String                                                                                              | **参数解释**： 评论创建人ID。 **取值范围**： 32个字符。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| modified_by           | String                                                                                              | **参数解释**： 评论最近修改人ID。 **取值范围**： 32个字符。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| created_date          | String                                                                                              | **参数解释**： 评论创建时间的unix时间戳，单位：毫秒。 **取值范围**： 10\~19个字符的数字字符串。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| modified_date         | String                                                                                              | **参数解释**： 评论最近修改时间的unix时间戳，单位：毫秒。 **取值范围**： 10\~19个字符的数字字符串。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| creator_info          | [UserVO] object                                           | **参数解释**： 评论创建人的详细信息，包括用户ID、用户名、昵称、租户ID、所属角色等属性。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| extend_attribute      | String                                                                                              | **参数解释**： 评论的扩展属性，表现为JSON字符串，主要用于描述系统生成评论所关联的操作信息（如状态流转、字段变更等），仅系统评论（category为operation）有值。 **取值范围**： 0\~10000个字符。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| extend_attribute_obj  | [CommentExtendAttribute] object           | **参数解释**： 评论的扩展属性对象，包含操作人、操作动作、状态流转前后值等结构化信息，仅系统评论（category为operation）有值。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| extend_attribute_objs | Array of [CommentExtendAttribute] objects | **参数解释**： 评论的扩展属性对象数组，包含多次扩展操作的结构化信息，仅系统评论（category为operation）有值。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
   
 表5CommentExtendAttribute 
| 参数              | 参数类型                                                      | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|
| operator        | [UserVO] object | **参数解释**： 操作人用户信息，包含用户ID、用户名、租户ID、所属角色等属性。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| operator_id     | String                                                    | **参数解释**： 操作人ID。 **取值范围**： 32个字符。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| action          | String                                                    | **参数解释**： 系统生成评论时执行的动作中文描述，例如保存初始需求、修改状态等。 **取值范围**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| action_us       | String                                                    | **参数解释**： 系统生成评论时执行的动作英文描述，与**action**字段含义相同，便于国际化场景使用。 **取值范围**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| object_type     | String                                                    | **参数解释**： 系统生成评论对应的对象类型，用于标识本次操作影响的对象维度，例如状态字段、责任人字段等。 **取值范围**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| pre_status_code | String                                                    | **参数解释**： 工作项流转前的状态Code，用于标识本次操作触发前工作项的状态。 **取值范围**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| new_status_code | String                                                    | **参数解释**： 工作项流转后的状态Code，用于标识本次操作触发后工作项的最新状态。 **取值范围**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| pre_status      | Object                                                    | **参数解释**： 工作项流转前的字段值，对象类型根据**field_type_id**取值不同： - 10001：StatusVO对象。   - 10007、10008：字符串。   - 10003、10004：日期时间。   - 10005、10006：数字。                                                                                                                                                                                                                              |
| new_status      | Object                                                    | **参数解释**： 工作项流转后的字段值，对象类型根据**field_type_id**取值不同： - 10001、10002：StatusVO对象。   - 10007、10008：字符串。   - 10003、10004：日期时间。   - 10005、10006：数字。   - 10009、10010：UserVO对象。    |
| field_type      | String                                                    | **参数解释**： 字段类型枚举值，与**field_type_id**配合使用，用于标识本次操作影响的字段类别，例如STATUS（状态）。 **取值范围**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| field_type_id   | String                                                    | **参数解释**： 字段类型对应的ID，与**field_type** 配合使用。常见取值及对应字段值类型请参见**pre_status** /**new_status**字段说明。 **取值范围**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| display_name    | String                                                    | **参数解释**： 字段显示名，用于在界面中标识本次操作影响的字段名称，例如"状态"、"责任人"等。 **取值范围**： 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
   
 表6UserVO 
| 参数          | 参数类型    | 描述                                                                                                                                                                                |
|:---|:---|:---|
| user_id     | String  | **参数解释**： 用户ID。 **取值范围**： 不涉及。                      |
| user_num_id | Integer | **参数解释**： 用户短ID。 **取值范围**： 不涉及。                     |
| user_name   | String  | **参数解释**： 用户名称。 **取值范围**： 不涉及。                      |
| domain_id   | String  | **参数解释**： 用户所属域ID。 **取值范围**： 不涉及。                   |
| domain_name | String  | **参数解释**： 租户名称。 **取值范围**： 不涉及。                      |
| nick_name   | String  | **参数解释**： 用户昵称。 **取值范围**： 不涉及。                      |
| role_id     | String  | **参数解释**： 角色ID，用户在项目中具有多个角色时用英文逗号分隔。 **取值范围**： 不涉及。 |
| role_name   | String  | **参数解释**： 用户角色名称，多个角色用英文逗号分隔。 **取值范围**： 不涉及。        |
| role_code   | String  | **参数解释**： 用户角色编码，多个角色用英文逗号分隔。 **取值范围**： 不涉及。        |
   
**状态码：400**
表7响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                            |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。 **取值范围**： 不涉及。                   |
| error_msg  | String | **参数解释**： 错误描述，对error_code的补充解释。 **取值范围**： 不涉及。 |
   
#### 请求示例
- 在项目99719a734aee4f20aae8c8e3bbd4e365下的IR工作项1223642181313880065中回复评论1223642621183123456，评论内容中包含了@其他用户c2d89e38a64a466f8f945f595df4402d
  ```
  POST https://{endpoint}/v1/ipdprojectservice/projects/99719a734aee4f20aae8c8e3bbd4e365/issues/1223642181313880065/comments
  {
    "category" : "reply",
    "issue_category" : "IR",
    "description" : "<p><span class=\"ql-mention-link\" data-mention-id=\"ForTest\" title=\"ForTest\" mentionchar=\"@\">﻿<span contenteditable=\"false\">@ForTest</span>﻿</span>&nbsp;看下呢</p>",
    "parent_id" : "1223642621183123456",
    "root_id" : "1223642621183123456",
    "at" : "c2d89e38a64a466f8f945f595df4402d",
    "at_others" : "c2d89e38a64a466f8f945f595df4402d"
  }
  ```
  
- 在项目99719a734aee4f20aae8c8e3bbd4e365下的IR工作项1223642181313880065中创建一条文字评论
  ```
  POST http://{{endpoint}}/v1/ipdprojectservice/projects/99719a734aee4f20aae8c8e3bbd4e365/issues/1223642181313880065/comments
  {
    "category" : "comment",
    "issue_category" : "IR",
    "description" : "<p>创建一个评论</p>"
  }
  ```
  
 
#### 响应示例
**状态码：200**
```
{
  "status" : "success",
  "message" : "",
  "result" : {
    "id" : "1223666764846850049",
    "category" : "Comment",
    "type" : "comment",
    "top" : false,
    "description" : "<p>创建一个系统评论</p>",
    "at" : "",
    "issue_id" : "1223642181313880065",
    "top_flag" : false,
    "created_by" : "c2d89e38a64a466f8f945f595df4402d",
    "created_date" : "1769674491368",
    "creator_info" : {
      "user_id" : "c2d89e38a64a466f8f945f595df4402d",
      "user_num_id" : null,
      "user_name" : "ForTest",
      "domain_id" : "aae03ca0d6814951980945b6eeca56cd",
      "domain_name" : null,
      "nick_name" : "ForTest",
      "role_id" : "5c78db505ee3486bb91840023c8e6d6c,d40d48b766d74ad680be222c128498c9",
      "role_name" : "项目经理,项目管理员",
      "role_code" : "Project manager,project_admin"
    }
  }
}
```
**状态码：400**
```
{
  "error_code" : "PM.02174103",
  "error_msg" : "无操作权限"
}
```
#### SDK代码示例
SDK代码示例如下。
#### Java
- 在项目99719a734aee4f20aae8c8e3bbd4e365下的IR工作项1223642181313880065中回复评论1223642621183123456，评论内容中包含了@其他用户c2d89e38a64a466f8f945f595df4402d
  ```
  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 CreateIpdIssueCommentsSolution {
      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();
          CreateIpdIssueCommentsRequest request = new CreateIpdIssueCommentsRequest();
          request.withProjectId("{project_id}");
          request.withIssueId("{issue_id}");
          CommentCreateVO body = new CommentCreateVO();
          body.withAt("c2d89e38a64a466f8f945f595df4402d");
          body.withRootId("1223642621183123456");
          body.withParentId("1223642621183123456");
          body.withDescription("<p><span class="ql-mention-link" data-mention-id="ForTest" title="ForTest" mentionchar="@">﻿<span contenteditable="false">@ForTest</span>﻿</span>&nbsp;看下呢</p>");
          body.withIssueCategory("IR");
          body.withCategory(CommentCreateVO.CommentCreateVO.fromValue("reply"));
          request.withBody(body);
          try {
              CreateIpdIssueCommentsResponse response = client.createIpdIssueComments(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());
          }
      }
  }
  ```
  
- 在项目99719a734aee4f20aae8c8e3bbd4e365下的IR工作项1223642181313880065中创建一条文字评论
  ```
  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 CreateIpdIssueCommentsSolution {
      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();
          CreateIpdIssueCommentsRequest request = new CreateIpdIssueCommentsRequest();
          request.withProjectId("{project_id}");
          request.withIssueId("{issue_id}");
          CommentCreateVO body = new CommentCreateVO();
          body.withDescription("<p>创建一个评论</p>");
          body.withIssueCategory("IR");
          body.withCategory(CommentCreateVO.CommentCreateVO.fromValue("comment"));
          request.withBody(body);
          try {
              CreateIpdIssueCommentsResponse response = client.createIpdIssueComments(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
- 在项目99719a734aee4f20aae8c8e3bbd4e365下的IR工作项1223642181313880065中回复评论1223642621183123456，评论内容中包含了@其他用户c2d89e38a64a466f8f945f595df4402d
  ```
  # 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 = CreateIpdIssueCommentsRequest()
          request.project_id = "{project_id}"
          request.issue_id = "{issue_id}"
          request.body = CommentCreateVO(
              at="c2d89e38a64a466f8f945f595df4402d",
              root_id="1223642621183123456",
              parent_id="1223642621183123456",
              description="<p><span class="ql-mention-link" data-mention-id="ForTest" title="ForTest" mentionchar="@">﻿<span contenteditable="false">@ForTest</span>﻿</span>&nbsp;看下呢</p>",
              issue_category="IR",
              category="reply"
          )
          response = client.create_ipd_issue_comments(request)
          print(response)
      except exceptions.ClientRequestException as e:
          print(e.status_code)
          print(e.request_id)
          print(e.error_code)
          print(e.error_msg)
  ```
  
- 在项目99719a734aee4f20aae8c8e3bbd4e365下的IR工作项1223642181313880065中创建一条文字评论
  ```
  # 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 = CreateIpdIssueCommentsRequest()
          request.project_id = "{project_id}"
          request.issue_id = "{issue_id}"
          request.body = CommentCreateVO(
              description="<p>创建一个评论</p>",
              issue_category="IR",
              category="comment"
          )
          response = client.create_ipd_issue_comments(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
- 在项目99719a734aee4f20aae8c8e3bbd4e365下的IR工作项1223642181313880065中回复评论1223642621183123456，评论内容中包含了@其他用户c2d89e38a64a466f8f945f595df4402d
  ```
  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.CreateIpdIssueCommentsRequest{}
  request.ProjectId = "{project_id}"
  request.IssueId = "{issue_id}"
  atCommentCreateVo:= "c2d89e38a64a466f8f945f595df4402d"
  rootIdCommentCreateVo:= "1223642621183123456"
  parentIdCommentCreateVo:= "1223642621183123456"
  descriptionCommentCreateVo:= "<p><span class="ql-mention-link" data-mention-id="ForTest" title="ForTest" mentionchar="@">﻿<span contenteditable="false">@ForTest</span>﻿</span>&nbsp;看下呢</p>"
  issueCategoryCommentCreateVo:= "IR"
  categoryCommentCreateVo:= model.GetCommentCreateVoCategoryEnum().REPLY
  request.Body = &model.CommentCreateVo{
  At: &atCommentCreateVo,
  RootId: &rootIdCommentCreateVo,
  ParentId: &parentIdCommentCreateVo,
  Description: &descriptionCommentCreateVo,
  IssueCategory: &issueCategoryCommentCreateVo,
  Category: &categoryCommentCreateVo,
  }
  response, err := client.CreateIpdIssueComments(request)
  if err == nil {
          fmt.Printf("%+v\n", response)
      } else {
          fmt.Println(err)
      }
  }
  ```
  
- 在项目99719a734aee4f20aae8c8e3bbd4e365下的IR工作项1223642181313880065中创建一条文字评论
  ```
  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.CreateIpdIssueCommentsRequest{}
  request.ProjectId = "{project_id}"
  request.IssueId = "{issue_id}"
  descriptionCommentCreateVo:= "<p>创建一个评论</p>"
  issueCategoryCommentCreateVo:= "IR"
  categoryCommentCreateVo:= model.GetCommentCreateVoCategoryEnum().COMMENT
  request.Body = &model.CommentCreateVo{
  Description: &descriptionCommentCreateVo,
  IssueCategory: &issueCategoryCommentCreateVo,
  Category: &categoryCommentCreateVo,
  }
  response, err := client.CreateIpdIssueComments(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=CreateIpdIssueComments)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述                     |
|:---|:---|
| 200 | 创建成功响应。                |
| 400 | 请求失败的响应。例如无操作权限、项目不存在。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-projectman/ErrorCode.html)。
