Updated on 2026-10-27 GMT+08:00

Querying Work Item Comments

Function

This API is used to list comments of a work item, including user-created text comments, user reply comments, and system-generated operation comments (such as status changes, field transitions, etc.). It supports filtering by comment type, sorting by creation time, and paginated queries.

Calling Method

For details, see Calling APIs.

Authorization Information

No identity policy-based permission required for calling this API.

URI

GET /v1/ipdprojectservice/projects/{project_id}/issues/{issue_id}/comments

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

32-character ID of a project, which must be unique. Obtain the value by calling the API for querying the IPD project list. The value of id in the response message body is the project ID.

Constraints

N/A

Range

A string of 32 characters consisting of letters and digits.

Default Value

N/A

issue_id

Yes

String

Definition

Unique ID of a work item. You can obtain the value from the Querying Work Items or Querying Tree-shaped Work Items API. The value is id in the response body.

Constraints

N/A

Range

A string of 18 to 19 digits.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

date_desc

No

Boolean

Definition

Whether to sort by creation time in descending order, used to control the sorting of the query result list.

Constraints

N/A

Range

  • true: Sorted by creation time in descending order, with the latest comment displayed first.

  • false: Sorted by creation time in ascending order, with the earliest comment displayed first.

Default Value

true

page_no

Yes

Integer

Definition

Page index, indicating the page number to start the query from. Used together with page_size to implement paginated queries.

Constraints

N/A

Range

1~10000

Default Value

1

page_size

Yes

Integer

Definition

Page size, indicating the number of comments returned per page. Used together with page_no to implement paginated queries.

Constraints

N/A

Range

1~200

Default Value

200

category

Yes

String

Definition

Comment type filter criteria. Multiple values are supported, separated by commas (,). Can be used to filter comments by type.

Constraints

N/A

Range

  • comment: Text comment created by a user.

  • reply: Comment replying to another user.

  • operation: Comment auto-generated by the system based on key operations, such as status transitions and field changes.

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

status

String

Definition

Response status, used to indicate whether the API call is successful.

Range

  • success: The comment list is queried successfully.

  • error: Querying the comment list failed.

message

String

Definition

Response message. The error message is returned when an API call fails.

result

CommentResult object

Definition

Comment query result, including the total number of comments and the comment list.

Table 4 CommentResult

Parameter

Type

Description

total

Integer

Definition

Total number of work item comments that meet the filter criteria.

Range

0–10000

comment_list

Array of CommentEntity objects

Definition

Work item comment list, including the comment ID, content, creator, creation time, and other complete attributes.

Table 5 CommentEntity

Parameter

Type

Description

id

String

Definition

Comment ID, which uniquely identifies a comment.

Range

A numeric string of 18 to 19 characters.

category

String

Definition

Comment type, which distinguishes between user-created comments, reply comments, and system-generated key operation comments.

Range

  • comment: Text comment created by a user.

  • reply: Comment replying to another user.

  • operation: Comment auto-generated by the system based on key operations, such as status transitions and field changes.

type

String

Definition

Comment metadata type, used by the frontend to distinguish the rendering format of comments.

Range

Fixed at comment.

top

Boolean

Definition

Whether to display the comment in the pinned area.

Range

  • true: Displayed in the pinned area.

  • false: Not displayed in the pinned area.

top_time

String

Definition

Unix timestamp of the pin time, in milliseconds. When there are multiple pinned comments, the most recently pinned comment is displayed at the top.

Range

A numeric string of 10 to 19 characters.

description

String

Definition

Comment content, described using HTML tags with support for rich text (including text, @mentions, images, and other elements).

Range

1 to 10,000 characters.

issue_id

String

Definition

ID of the work item to which the comment belongs. It can be obtained by calling the Querying the Work Item List API. The value of the id field in the response body is the work item ID.

Range

A numeric string of 18 to 19 characters.

top_flag

Boolean

Definition

Whether the current comment is pinned.

Range

  • true: Pinned.

  • false: Not pinned.

created_by

String

Definition

Comment creator ID.

Range

32 characters.

modified_by

String

Definition

Last modifier ID of the comment.

Range

32 characters.

created_date

String

Definition

Unix timestamp of the comment creation time, in milliseconds.

Range

A numeric string of 10 to 19 characters.

modified_date

String

Definition

Unix timestamp of the last modification time of the comment, in milliseconds.

Range

A numeric string of 10 to 19 characters.

creator_info

UserVO object

Definition

Detailed information of the comment creator, including the user ID, username, nickname, tenant ID, role, and other attributes.

extend_attribute

String

Definition

Extended attributes of the comment, expressed as a JSON string, mainly used to describe the operation information associated with system-generated comments (such as status transitions and field changes). Only system comments (category: operation) have this value.

Range

0 to 10,000 characters.

extend_attribute_obj

CommentExtendAttribute object

Definition

Extended attribute object of the comment, containing structured information such as the operator, operation action, and values before and after status transitions. Only system comments (category: operation) have this value.

extend_attribute_objs

Array of CommentExtendAttribute objects

Definition

Array of extended attribute objects for comments, containing structured information for multiple extended operations. Only system comments (category: operation) have this value.

Table 6 CommentExtendAttribute

Parameter

Type

Description

operator

UserVO object

Definition

Operator user information, including the user ID, username, tenant ID, role, and other attributes.

operator_id

String

Definition

Operator ID.

Range

32 characters.

action

String

Definition

Chinese description of the action performed when the system generates a comment, such as saving the initial requirement or modifying the status.

Range

N/A

action_us

String

Definition

English description of the action performed when the system generates a comment, with the same meaning as the action field, used for internationalization scenarios.

Range

N/A

object_type

String

Definition

Object type corresponding to the system-generated comment, used to identify the dimension of the object affected by this operation, such as the status field or owner field.

Range

N/A

pre_status_code

String

Definition

Status code of the work item before transition, used to identify the previous status of the work item before this operation.

Range

N/A

new_status_code

String

Definition

Status code of the work item after transition, used to identify the latest status of the work item after this operation.

Range

N/A

pre_status

Object

Definition

Field value of the work item before transition. The object type varies depending on the field_type_id value.

  • 10001: StatusVO object.

  • 10007, 10008: String.

  • 10003, 10004: Date and time.

  • 10005, 10006: Number.

new_status

Object

Definition

Field value of the work item after transition. The object type varies depending on the field_type_id value.

  • 10001, 10002: StatusVO object.

  • 10007, 10008: String.

  • 10003, 10004: Date and time.

  • 10005, 10006: Number.

  • 10009, 10010: UserVO object.

field_type

String

Definition

Field type enumeration value, used together with field_type_id to identify the field type affected by this operation, such as STATUS.

Range

N/A

field_type_id

String

Definition

ID corresponding to the field type, used together with field_type. For common values and corresponding field value types, see the pre_status/new_status field description.

Range

N/A

display_name

String

Definition

Field display name, used to identify the name of the field affected by this operation in the UI, such as status and owner.

Range

N/A

Table 7 UserVO

Parameter

Type

Description

user_id

String

Definition

User ID.

Range

N/A

user_num_id

Integer

Definition

Short ID of a user.

Range

N/A

user_name

String

Definition

Username.

Range

N/A

domain_id

String

Definition

ID of the domain to which the user belongs.

Range

N/A

domain_name

String

Definition

Tenant name.

Range

N/A

nick_name

String

Definition

User alias.

Range

N/A

role_id

String

Definition

Role ID. If a user has multiple roles in a project, use commas (,) to separate the values.

Range

N/A

role_name

String

Definition

Role name. If a user has multiple roles, use commas (,) to separate the values.

Range

N/A

role_code

String

Definition

Role code. If a user has multiple roles, use commas (,) to separate the values.

Range

N/A

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description, which is a supplement to error_code.

Range

N/A

Example Requests

Query the first page of comments for work item 1111014158531207168 under project 4f967f6f05554273b0476da123e73b41, with 50 comments per page, including comments, replies, and system operations.

GET https://{endpoint}/v1/ipdprojectservice/projects/4f967f6f05554273b0476da123e73b41/issues/1111014158531207168/comments?date_desc=true&domain_id=1050710945110597632&page_no=1&page_size=50&category=comment,reply,operation

Example Responses

Status code: 200

{
  "status" : "success",
  "message" : null,
  "result" : {
    "total" : 4,
    "comment_list" : [ {
      "id" : "1111014460409032705",
      "category" : "Comment",
      "type" : "comment",
      "top" : true,
      "description" : "<p>This is a pinned comment.</p>",
      "issue_id" : "1111014158531207168",
      "top_time" : "1742816095000",
      "top_flag" : true,
      "created_by" : "a360371833bf4c558f796fd707b44daf",
      "created_date" : "1742816089000",
      "creator_info" : {
        "user_id" : "a360371833bf4c558f796fd707b44daf",
        "user_num_id" : 4091,
        "user_name" : "devcloud_devcloud_xxx_01",
        "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
        "domain_name" : "devcloud_devcloud_xxx_01",
        "nick_name" : "Test account.",
        "role_id" : null,
        "role_name" : null,
        "role_code" : null
      }
    }, {
      "id" : "1111014460409032705",
      "category" : "Comment",
      "type" : "comment",
      "top" : false,
      "description" : "<p>This is a pinned comment.</p>",
      "issue_id" : "1111014158531207168",
      "top_time" : "1742816095000",
      "top_flag" : true,
      "created_by" : "a360371833bf4c558f796fd707b44daf",
      "created_date" : "1742816089000",
      "creator_info" : {
        "user_id" : "a360371833bf4c558f796fd707b44daf",
        "user_num_id" : 4091,
        "user_name" : "devcloud_devcloud_xxx_01",
        "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
        "domain_name" : "devcloud_devcloud_xxx_01",
        "nick_name" : "Test account.",
        "role_id" : null,
        "role_name" : null,
        "role_code" : null
      }
    }, {
      "id" : "1111014393723793409",
      "category" : "Comment",
      "type" : "comment",
      "top" : false,
      "description" : "<p>This is a comment with @mention&nbsp;<span class=\"ql-mention-link\" title=\"landingzone_xwq\" mentionchar=\"@\"><span contenteditable=\"false\">@landingzone_xwq</span></span></p>",
      "issue_id" : "1111014158531207168",
      "top_flag" : false,
      "created_by" : "a360371833bf4c558f796fd707b44daf",
      "created_date" : "1742816073000",
      "creator_info" : {
        "user_id" : "a360371833bf4c558f796fd707b44daf",
        "user_num_id" : 4091,
        "user_name" : "devcloud_devcloud_xxx_01",
        "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
        "domain_name" : "devcloud_devcloud_xxx_01",
        "nick_name" : "Test account.",
        "role_id" : null,
        "role_name" : null,
        "role_code" : null
      }
    }, {
      "id" : "1111014282305118208",
      "category" : "Comment",
      "type" : "comment",
      "top" : false,
      "description" : "<p>This is a comment with an image.</p><p><img src=\"/api/ipdproject/openapi/v1/projects/4f967f6f05554273b0476da123e73b41/imgs/a152cf8e8a374ba38a971c2ac701c005.png\" style=\"vertical-align: baseline;\"></p>",
      "issue_id" : "1111014158531207168",
      "top_flag" : false,
      "created_by" : "a360371833bf4c558f796fd707b44daf",
      "created_date" : "1742816046000",
      "creator_info" : {
        "user_id" : "a360371833bf4c558f796fd707b44daf",
        "user_num_id" : 4091,
        "user_name" : "devcloud_devcloud_xxx_01",
        "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
        "domain_name" : "devcloud_devcloud_xxx_01",
        "nick_name" : "Test account.",
        "role_id" : null,
        "role_name" : null,
        "role_code" : null
      }
    }, {
      "id" : "1111014159198101507",
      "category" : "Operation",
      "type" : "comment",
      "top" : false,
      "issue_id" : "1111014158531207168",
      "top_flag" : false,
      "extend_attribute" : "[{\"action\": \"Save initial requirement\", \"action_u_s\": \"Save Initial Requirement\", \"object_type\": \"status\", \"operator_id\": \"a360371833bf4c558f796fd707b44daf\", \"new_status_code\": \"Start\", \"pre_status_code\": \"_Start_\"}]",
      "created_by" : "a360371833bf4c558f796fd707b44daf",
      "created_date" : "1742816017000",
      "creator_info" : {
        "user_id" : "a360371833bf4c558f796fd707b44daf",
        "user_num_id" : 4091,
        "user_name" : "devcloud_devcloud_xxx_01",
        "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
        "domain_name" : "devcloud_devcloud_xxx_01",
        "nick_name" : "Test account.",
        "role_id" : null,
        "role_name" : null,
        "role_code" : null
      },
      "extend_attribute_obj" : {
        "operator" : {
          "watcher" : null,
          "user_id" : "a360371833bf4c558f796fd707b44daf",
          "user_num_id" : 4091,
          "user_name" : "devcloud_devcloud_xxx_01",
          "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
          "domain_name" : "devcloud_devcloud_xxx_01",
          "nick_name" : "Test account.",
          "role_id" : null,
          "role_name" : null,
          "image_id" : null,
          "region" : null,
          "opinion" : null,
          "description" : null,
          "owner" : null,
          "ccbId" : null,
          "has_removed" : null
        },
        "operator_id" : "a360371833bf4c558f796fd707b44daf",
        "action" : "Save initial requirement.",
        "action_us" : "Save Initial Requirement",
        "object_type" : "status",
        "pre_status_code" : "_Start_",
        "new_status_code" : "Start",
        "pre_status" : null,
        "new_status" : {
          "id" : "1050710945727160334",
          "belonging" : "START",
          "name" : "Initial.",
          "code" : "Start",
          "definition_type" : "5",
          "belong_definition_type" : 3,
          "display_value" : "Initial.",
          "position" : 1,
          "displayable" : 1,
          "editable" : 1,
          "deletable" : 1,
          "mutable" : 1,
          "title_py" : "cs",
          "created_by" : "a360371833bf4c558f796fd707b44daf",
          "created_date" : 1728467410000,
          "modified_date" : 1728467410000,
          "modified_by" : "a360371833bf4c558f796fd707b44daf",
          "linkage_node_fields" : false
        },
        "field_type" : "STATUS",
        "field_type_id" : "10001",
        "display_name" : "Status."
      },
      "extend_attribute_objs" : [ {
        "operator" : {
          "watcher" : null,
          "user_id" : "a360371833bf4c558f796fd707b44daf",
          "user_num_id" : 4091,
          "user_name" : "devcloud_devcloud_xxx_01",
          "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
          "domain_name" : "devcloud_devcloud_xxx_01",
          "nick_name" : "Test account.",
          "role_id" : null,
          "role_name" : null,
          "image_id" : null,
          "region" : null,
          "opinion" : null,
          "description" : null,
          "owner" : null,
          "ccbId" : null,
          "has_removed" : null
        },
        "operator_id" : "a360371833bf4c558f796fd707b44daf",
        "action" : "Save initial requirement.",
        "action_us" : "Save Initial Requirement",
        "object_type" : "status",
        "pre_status_code" : "_Start_",
        "new_status_code" : "Start",
        "pre_status" : null,
        "new_status" : {
          "id" : "1050710945727160334",
          "belonging" : "START",
          "space_id" : "1050710945110597632",
          "name" : "Initial.",
          "code" : "Start",
          "definition_type" : "5",
          "belong_definition_type" : 3,
          "display_value" : "Initial.",
          "position" : 1,
          "displayable" : 1,
          "editable" : 1,
          "deletable" : 1,
          "mutable" : 1,
          "title_py" : "cs",
          "created_by" : "a360371833bf4c558f796fd707b44daf",
          "created_date" : 1728467410000,
          "modified_date" : 1728467410000,
          "modified_by" : "a360371833bf4c558f796fd707b44daf",
          "linkage_node_fields" : false
        },
        "field_type" : "STATUS",
        "field_type_id" : "10001",
        "display_name" : "Status."
      } ]
    } ]
  }
}

Status code: 400

{
  "error_code" : "PM.02174103",
  "error_msg" : "No permission."
}

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
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 ListIpdIssueCommentsSolution {

    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();
        ListIpdIssueCommentsRequest request = new ListIpdIssueCommentsRequest();
        request.withProjectId("{project_id}");
        request.withIssueId("{issue_id}");
        try {
            ListIpdIssueCommentsResponse response = client.listIpdIssueComments(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
# 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 = ListIpdIssueCommentsRequest()
        request.project_id = "{project_id}"
        request.issue_id = "{issue_id}"
        response = client.list_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

 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
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.ListIpdIssueCommentsRequest{}
	request.ProjectId = "{project_id}"
	request.IssueId = "{issue_id}"
	response, err := client.ListIpdIssueComments(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

More

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Response for a successful query.

400

Response upon a request failure. For example, the user does not have the operation permission or the project does not exist.

Error Codes

See Error Codes.