更新时间:2026-02-05 GMT+08:00

查询待办列表 - ListTasks

功能介绍

查询待办列表

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项

URI

GET /v1/{project_id}/workspaces/{workspace_id}/soc/tasks

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:

项目ID,用于明确项目归属,配置后可通过该ID查询项目下资产,可以通过调用API获取,也可以从控制台获取。获取项目ID

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

workspace_id

String

参数解释:

工作空间ID

取值范围:

不涉及

表2 Query参数

参数

是否必选

参数类型

描述

offset

Integer

参数解释:

待办请求的偏移量

约束限制:

不涉及

取值范围:

0-9999

默认值:

0

limit

Integer

参数解释:

待办分页大小

约束限制:

不涉及

取值范围:

1-100

默认值:

10

sort_key

String

参数解释:

待办的排序字段

  • create_time 按照创建时间排序

  • update_time 按照更新时间排序

约束限制:

不涉及

取值范围:

  • create_time

  • update_time

默认值:

create_time

sort_dir

String

参数解释:

待办的排序方式

  • ASC 按照升序排序

  • DESC 按照降序排序

约束限制:

不涉及

取值范围:

  • ASC

  • DESC

默认值:

DESC

note

String

参数解释:

待办的备注

约束限制:

不涉及

取值范围:

不涉及

默认值:

不涉及

name

String

参数解释:

待办的任务名称

约束限制:

不涉及

取值范围:

不涉及

默认值:

不涉及

business_type

String

参数解释:

待办的业务类型

  • WORKFLOWPUBLISH 流程发布

  • WORKFLOWNODEAPPROVE 流程节点审核

  • PLAYBOOKPUBLISH 剧本发布

  • PLAYBOOKNODEAPPROVE 剧本节点审核

约束限制:

不涉及

取值范围:

  • WORKFLOWPUBLISH

  • WORKFLOWNODEAPPROVE

  • PLAYBOOKPUBLISH

  • PLAYBOOKNODEAPPROVE

默认值:

不涉及

creator_name

String

参数解释:

待办的创建人

约束限制:

不涉及

取值范围:

不涉及

默认值:

不涉及

query_type

String

参数解释:

待办的分类

  • my_todo 待处理的待办

  • all_handled 已处理的待办

约束限制:

不涉及

取值范围:

  • my_todo

  • all_handled

默认值:

my_todo

from_date

String

参数解释:

起始时间,格式是 "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'Z"

约束限制:

不涉及

取值范围:

不涉及

默认值:

不涉及

to_date

String

参数解释:

的截止时间,格式是 "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'Z"

约束限制:

不涉及

取值范围:

不涉及

默认值:

不涉及

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

租户的Token

约束限制:

不涉及

取值范围:

不涉及

默认值:

不涉及

Content-Type

String

参数解释:

内容类型

  • application/json;charset=UTF-8 普通API请求的类型

约束限制:

不涉及

取值范围:

  • application/json;charset=UTF-8

默认取值:

不涉及

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

code

String

参数解释:

错误码,当请求成功时值为 "00000000"

取值范围:

不涉及

message

String

参数解释:

错误信息的描述

取值范围:

不涉及

total

Number

参数解释:

待办的总数

取值范围:

不涉及

page

Number

参数解释:

待办请求的偏移量

取值范围:

1-100

size

Number

参数解释:

待办的分页的大小

取值范围:

1-100

request_id

String

参数解释:

请求的ID

约束限制:

不涉及

success

Boolean

参数解释:

是否成功

取值范围:

  • true 成功

  • false 失败

data

Array of TaskInfo objects

list of informations of task

表5 TaskInfo

参数

参数类型

描述

id

String

参数解释:

待办任务的ID

取值范围:

不涉及

aopengine_task_id

String

参数解释:

待办任务的引擎任务Id

取值范围:

不涉及.

name

String

参数解释:

待办任务的名称

取值范围:

不涉及

project_id

String

参数解释:

待办任务的项目Id

取值范围:

不涉及

description

String

参数解释:

待办任务的描述

取值范围:

不涉及

create_time

String

参数解释:

待办的创建时间

取值范围:

不涉及

creator_id

String

参数解释:

待办的创建者ID

取值范围:

system

creator_name

String

参数解释:

待办的创建者名字

取值范围:

不涉及

update_time

String

参数解释:

待办的更新时间

取值范围:

不涉及

modifier_id

String

参数解释:

待办的修改者ID

取值范围:

system

modifier_name

String

参数解释:

待办的修改者名字

取值范围:

不涉及

approveuser_id

String

参数解释:

待办支持的审核人用户ID

取值范围:

不涉及

approveuser_name

String

参数解释:

待办支持的审核人用户名字

取值范围:

不涉及

approver

String

参数解释:

待办审核人用户名称

取值范围:

不涉及

notes

String

参数解释:

待办的备注

取值范围:

不涉及

definition_key

String

参数解释:

待办的节点流程拓扑图的KEY

取值范围:

不涉及

note

String

参数解释:

待办的备注

取值范围:

不涉及

due_date

String

参数解释:

待办的超期时间

取值范围:

默认为创建时间+15天

action_id

String

参数解释:

待办的节点的流程或剧本ID

当 business_type是WORKFLOWPUBLISH或者WORKFLOWNODEAPPROVE,此时为流程ID

当 business_type是PLAYBOOKPUBLISH或者PLAYBOOKNODEAPPROVE,此时为剧本ID

取值范围:

不涉及

action_version_id

String

参数解释:

待办的节点的流程或剧本版本ID

当 business_type是WORKFLOWPUBLISH或者WORKFLOWNODEAPPROVE,此时为流程版本ID

当 business_type是PLAYBOOKPUBLISH或者PLAYBOOKNODEAPPROVE,此时为剧本版本ID

取值范围:

不涉及

action_instance_id

String

参数解释:

待办的节点的流程或剧本的实例ID

当 business_type是WORKFLOWNODEAPPROVE,此时为流程实例ID

当 business_type是PLAYBOOKNODEAPPROVE,此时为剧本实例ID

取值范围:

不涉及

workspace_id

String

参数解释:

待办任务的空间ID

取值范围:

不涉及

review_comments

String

参数解释:

待办任务审核意见

取值范围:

不涉及

view_parameters

String

参数解释:

待办任务查看参数

取值范围:

不涉及

handle_parameters

String

参数解释:

待办任务的人工处理参数

取值范围:

不涉及

business_type

String

参数解释:

待办的业务类型

  • WORKFLOWPUBLISH 流程发布

  • WORKFLOWNODEAPPROVE 流程节点审核

  • PLAYBOOKPUBLISH 剧本发布

  • PLAYBOOKNODEAPPROVE 剧本节点审核

取值范围:

  • WORKFLOWPUBLISH

  • WORKFLOWNODEAPPROVE

  • PLAYBOOKPUBLISH

  • PLAYBOOKNODEAPPROVE

related_object

String

参数解释:

待办任务的关联的流程 or 剧本名称

取值范围:

不涉及

attachment_id_list

Array of strings

参数解释:

待办节点的附件ID列表

取值范围:

不涉及

comments

Array of TaskCommentInfo objects

参数解释:

待办节点的待办评论

取值范围:

不涉及

status

String

参数解释:

待办的业务类型

  • waiting 待处理

  • canceled 已取消

  • finished 已完成

取值范围:

  • waiting

  • canceled

  • finished

due_handle

String

参数解释:

待办的到期处理方式

  • CONTINUE 继续执行

  • INTERRUPT 终止

取值范围:

  • CONTINUE

  • INTERRUPT

表6 TaskCommentInfo

参数

参数类型

描述

id

String

参数解释:

待办评论ID

取值范围:

不涉及

message

String

参数解释:

待办评论信息

取值范围:

不涉及

user_id

String

参数解释:

创建待办评论的用户ID

取值范围:

不涉及

user_name

String

参数解释:

创建待办评论的用户名称

取值范围:

不涉及

time

Long

参数解释:

创建待办评论的时间

取值范围:

不涉及

状态码:400

表7 响应Body参数

参数

参数类型

描述

code

String

参数解释:

错误码

取值范围:

不涉及

message

String

参数解释:

错误描述

取值范围:

不涉及

请求示例

  • 查的我的待办

    https://{endpoint}/v1/{project_id}/workspaces/{workspace_id}/soc/tasks?query_type=my_todo&offset=0&limit=10
  • 查询已处理的待办

    https://{endpoint}/v1/{project_id}/workspaces/{workspace_id}/soc/tasks?query_type=all_handled&offset=1&limit=10

响应示例

状态码:200

Response of listing task informations

{
  "code" : "00000000",
  "data" : [ {
    "id" : "3e4c170e-7cc9-11f0-9216-fa163e209978",
    "aopengine_task_id" : "3e4c170e-7cc9-11f0-9216-fa163e209978",
    "name" : "test task",
    "project_id" : "15645222e8744afa985c93dab6341da6",
    "description" : "",
    "create_time" : "2025-08-19T14:53:42.424Z+0800",
    "creator_id" : "",
    "creator_name" : "XXXX",
    "modifier_id" : "",
    "modifier_name" : "",
    "update_time" : "2025-08-19T16:50:23.743Z+0800",
    "approveuser_id" : "",
    "approveuser_name" : "",
    "approver" : "",
    "notes" : "006",
    "definition_key" : "Activity_1xkg6ju",
    "due_date" : "2025-09-03T14:53:42.398Z+0800",
    "action_id" : "e1426fd5-bf48-3b71-8f8e-d5ca1047f68b",
    "action_version_id" : "0696648d-9d20-4e21-b1fd-24f9a6f4918c",
    "action_instance_id" : "xxxxx",
    "workspace_id" : "75645d0a-93b8-4a7f-a77c-e97009389445",
    "view_parameters" : "",
    "handle_parameters" : "",
    "review_comments" : "",
    "business_type" : "PLAYBOOKNODEAPPROVE",
    "related_object" : "test",
    "attachment_id_list" : [ ],
    "comments" : [ ],
    "due_handle" : "",
    "status" : "waiting"
  } ],
  "message" : "",
  "page" : 1,
  "request_id" : "",
  "size" : 50,
  "success" : true,
  "total" : 1
}

SDK代码示例

SDK代码示例如下。

 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
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.secmaster.v1.region.SecMasterRegion;
import com.huaweicloud.sdk.secmaster.v1.*;
import com.huaweicloud.sdk.secmaster.v1.model.*;


public class ListTasksSolution {

    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");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        SecMasterClient client = SecMasterClient.newBuilder()
                .withCredential(auth)
                .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                .build();
        ListTasksRequest request = new ListTasksRequest();
        request.withWorkspaceId("{workspace_id}");
        try {
            ListTasksResponse response = client.listTasks(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());
        }
    }
}
 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 huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdksecmaster.v1 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"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = SecMasterClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListTasksRequest()
        request.workspace_id = "{workspace_id}"
        response = client.list_tasks(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/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")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := secmaster.NewSecMasterClient(
        secmaster.SecMasterClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListTasksRequest{}
	request.WorkspaceId = "{workspace_id}"
	response, err := client.ListTasks(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

Response of listing task informations

400

Error response

错误码

请参见错误码