# 列取任务列表

基于调用身份，列出特定类型的所有任务。支持分页。

目前只支持列取任务界面上“我负责的”任务。返回的任务数据按照任务在”我负责的“界面中”自定义拖拽“的顺序排序。

## 请求

基本 | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/task/v2/tasks
HTTP Method | GET
接口频率限制 | [1000 次/分钟、50 次/秒](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
支持的应用类型 | Custom App、Store App
权限要求<br>**调用该 API 所需的权限。开启其中任意一项权限即可调用**<br>开启任一权限即可 | 查看任务信息(task:task:read)<br>查看、创建、更新、删除任务(task:task:write)

### 请求头

名称 | 类型 | 必填 | 描述
---|---|---|---
Authorization | string | 是 | `user_access_token`<br>**值格式**："Bearer `access_token`"<br>**示例值**："Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[了解更多：如何选择与获取 access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)

### 查询参数

名称 | 类型 | 必填 | 描述
---|---|---|---
page_size | int | 否 | 每页的任务数量<br>**示例值**：50<br>**默认值**：`50`<br>**数据校验规则**：<br>- 取值范围：`1` ～ `100`
page_token | string | 否 | 分页标记，第一次请求不填，表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token，下次遍历可采用该 page_token 获取查询结果<br>**示例值**：aWQ9NzEwMjMzMjMxMDE=
completed | boolean | 否 | 是否按任务完成进行过滤。填写true表示只列出已完成任务；填写false表示只列出未完成任务。不填写表示不过滤。<br>**示例值**：true
type | string | 否 | 列取任务的类型，目前只支持"my_tasks"，即“我负责的”。<br>**示例值**：my_tasks<br>**默认值**：`my_tasks`
user_id_type | string | 否 | 用户 ID 类型<br>**示例值**：open_id<br>**默认值**：`open_id`

## 响应

### 响应体

名称 | 类型 | 描述
---|---|---
code | int | 错误码，非 0 表示失败
msg | string | 错误描述
data | \- | \-
items | task\[\] | 返回的任务列表
guid | string | 任务guid，任务的唯一ID
summary | string | 任务标题
description | string | 任务备注
due | due | 任务截止时间
timestamp | string | 截止时间/日期的时间戳，距1970-01-01 00:00:00的毫秒数。<br>- 如果是截止日期（`is_all_day` 取值为 true），则该时间戳转换为具体时间后，只需精确到天。例如 `1724284800000` 转换为具体时间为 `2024-08-22`。<br>- 如果是截止时间（`is_all_day` 取值为 false），则该时间戳转换为具体时间后，精确到秒。例如 `1724284800000` 转换为具体时间为 `2024-08-22 08:00:00 UTC+8`。
is_all_day | boolean | 是否截止到一个日期。可能值有：<br>- true：截止日期，`timestamp` 转换为具体时间后精确到天。<br>- false：截止时间，`timestamp` 转换为具体时间后精确到秒。
reminders | reminder\[\] | 任务的提醒配置列表。目前每个任务最多有1个。
id | string | 提醒时间设置的 ID
relative_fire_minute | int | 相对于截止时间的提醒时间分钟数。例如30表示截止时间前30分钟提醒；0表示截止时提醒。<br>**注意**：该参数值可能为负值。例如，在客户端创建的任务未设置具体截止时间，则该任务的截止时间默认为当天 00:00，如果任务提醒时间为当天 18:00，则 `relative_fire_minute` 返回值为 -1080。
creator | member | 任务创建者
id | string | 表示member的id
type | string | 成员的类型
role | string | 成员角色
members | member\[\] | 任务成员列表
id | string | 表示member的id
type | string | 成员的类型
role | string | 成员角色
completed_at | string | 任务完成的时间戳(ms)
attachments | attachment\[\] | 任务的附件列表
guid | string | 附件guid
file_token | string | 附件在云文档系统中的token
name | string | 附件名
size | int | 附件的字节大小
resource | resource | 附件归属的资源
type | string | 资源类型
id | string | 资源ID
uploader | member | 附件上传者
id | string | 表示member的id
type | string | 成员的类型
role | string | 成员角色
is_cover | boolean | 是否是封面图
uploaded_at | string | 上传时间戳(ms)
origin | origin | 任务关联的第三方平台来源信息。创建是设置后就不可更改。
platform_i18n_name | i18n_text | 任务导入来源的名称，用于在任务中心详情页展示。需提供多语言版本。
en_us | string | 英文
zh_cn | string | 中文
zh_hk | string | 中文（香港地区）
zh_tw | string | 中文（台湾地区）
ja_jp | string | 日语
fr_fr | string | 法语
it_it | string | 意大利语
de_de | string | 德语
ru_ru | string | 俄语
th_th | string | 泰语
es_es | string | 西班牙语
ko_kr | string | 韩语
href | href | 任务关联的来源平台详情页链接
url | string | 链接对应的地址
title | string | 链接对应的标题
extra | string | 任务附带的自定义数据。
tasklists | task_in_tasklist_info\[\] | 任务所属清单的名字。调用者只能看到有权限访问的清单的列表。
tasklist_guid | string | 任务所在清单的guid
section_guid | string | 任务所在清单的自定义分组guid
repeat_rule | string | 如果任务为重复任务，返回重复任务的配置
parent_task_guid | string | 如果当前任务为某个任务的子任务，返回父任务的guid
mode | int | 任务的模式。1 - 会签任务；2 - 或签任务
source | int | 任务创建的来源<br>**可选值有**：<br>- 0：未知来源<br>- 1：任务中心<br>- 2：群组任务/消息转任务<br>- 6：通过开放平台以tenant_access_token授权创建的任务<br>- 7：通过开放平台以user_access_token授权创建的任务<br>- 8：文档任务
custom_complete | custom_complete | 任务的自定义完成配置
pc | custom_complete_item | pc客户端自定义完成配置（含mac和windows）
href | string | 自定义完成的跳转url
tip | i18n_text | 自定义完成的弹出提示为
en_us | string | 英文
zh_cn | string | 中文
zh_hk | string | 中文（香港地区）
zh_tw | string | 中文（台湾地区）
ja_jp | string | 日语
fr_fr | string | 法语
it_it | string | 意大利语
de_de | string | 德语
ru_ru | string | 俄语
th_th | string | 泰语
es_es | string | 西班牙语
ko_kr | string | 韩语
ios | custom_complete_item | ios端的自定义完成配置
href | string | 自定义完成的跳转url
tip | i18n_text | 自定义完成的弹出提示为
en_us | string | 英文
zh_cn | string | 中文
zh_hk | string | 中文（香港地区）
zh_tw | string | 中文（台湾地区）
ja_jp | string | 日语
fr_fr | string | 法语
it_it | string | 意大利语
de_de | string | 德语
ru_ru | string | 俄语
th_th | string | 泰语
es_es | string | 西班牙语
ko_kr | string | 韩语
android | custom_complete_item | android端的自定义完成配置
href | string | 自定义完成的跳转url
tip | i18n_text | 自定义完成的弹出提示为
en_us | string | 英文
zh_cn | string | 中文
zh_hk | string | 中文（香港地区）
zh_tw | string | 中文（台湾地区）
ja_jp | string | 日语
fr_fr | string | 法语
it_it | string | 意大利语
de_de | string | 德语
ru_ru | string | 俄语
th_th | string | 泰语
es_es | string | 西班牙语
ko_kr | string | 韩语
task_id | string | 任务界面上的代码
created_at | string | 任务创建时间戳(ms)
updated_at | string | 任务最后一次更新的时间戳(ms)
status | string | 任务的状态，支持"todo"和"done"两种状态
url | string | 任务的分享链接
start | start | 任务的开始时间
timestamp | string | 开始时间/日期的时间戳，距1970-01-01 00:00:00的毫秒数。如果开始时间是一个日期，需要把日期转换成时间戳，并设置 is_all_day=true
is_all_day | boolean | 是否开始于一个日期。如果设为true，timestamp中只有日期的部分会被解析和存储。
subtask_count | int | 该任务的子任务的个数。
is_milestone | boolean | 是否是里程碑任务
custom_fields | custom_field_value\[\] | 任务的自定义字段值
guid | string | 字段GUID
type | string | 自定义字段类型，支持"member", "datetime", "number", "single_select", "multi_select"五种类型
number_value | string | 数字类型的自定义字段值，填写一个合法数字的字符串表示，空字符串表示设为空。
datetime_value | string | 日期类型自定义字段值。可以输入一个表示日期的以毫秒为单位的字符串。设为空字符串表示设为空。
member_value | member\[\] | 人员类型的自定义字段值，可以设置1个或多个用户的id（遵循member格式，只支持user类型）。当该字段的设置为“不能多选”时只能输入一个值。设为空数组表示设为空。
id | string | 表示member的id
type | string | 成员的类型
role | string | 成员角色
single_select_value | string | 单选类型字段值，填写一个字段选项的option_guid。设置为空字符串表示设为空。
multi_select_value | string\[\] | 多选类型字段值，可以填写一个或多个本字段的option_guid。设为空数组表示设为空。
name | string | 自定义字段名
dependencies | task_dependency\[\] | 任务依赖
type | string | 依赖类型<br>**可选值有**：<br>- prev：前置依赖<br>- next：后置依赖
task_guid | string | 依赖任务的GUID
page_token | string | 分页标记，当 has_more 为 true 时，会同时返回新的 page_token，否则不返回 page_token
has_more | boolean | 是否还有更多项

### 响应体示例
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "items": [
            {
                "guid": "83912691-2e43-47fc-94a4-d512e03984fa",
                "summary": "进行销售年中总结",
                "description": "进行销售年中总结",
                "due": {
                    "timestamp": "1675454764000",
                    "is_all_day": true
                },
                "reminders": [
                    {
                        "id": "10",
                        "relative_fire_minute": 30
                    }
                ],
                "creator": {
                    "id": "ou_2cefb2f014f8d0c6c2d2eb7bafb0e54f",
                    "type": "user",
                    "role": "assignee"
                },
                "members": [
                    {
                        "id": "ou_2cefb2f014f8d0c6c2d2eb7bafb0e54f",
                        "type": "user",
                        "role": "editor"
                    }
                ],
                "completed_at": "1675742789470",
                "attachments": [
                    {
                        "guid": "f860de3e-6881-4ddd-9321-070f36d1af0b",
                        "file_token": "boxcnTDqPaRA6JbYnzQsZ2doB2b",
                        "name": "foo.jpg",
                        "size": 62232,
                        "resource": {
                            "type": "task",
                            "id": "e6e37dcc-f75a-5936-f589-12fb4b5c80c2"
                        },
                        "uploader": {
                            "id": "ou_2cefb2f014f8d0c6c2d2eb7bafb0e54f",
                            "type": "user",
                            "role": "assignee"
                        },
                        "is_cover": false,
                        "uploaded_at": "1675742789470"
                    }
                ],
                "origin": {
                    "platform_i18n_name": {
                        "en_us": "workbench",
                        "zh_cn": "工作台",
                        "zh_hk": "工作臺",
                        "zh_tw": "工作臺",
                        "ja_jp": "作業台",
                        "fr_fr": "Table de travail",
                        "it_it": "banco di lavoro",
                        "de_de": "Werkbank",
                        "ru_ru": "верстак",
                        "th_th": "โต๊ะทำงาน",
                        "es_es": "banco de trabajo",
                        "ko_kr": "작업대"
                    },
                    "href": {
                        "url": "https://www.example.com",
                        "title": "反馈一个问题，需要协助排查"
                    }
                },
                "extra": "dGVzdA==",
                "tasklists": [
                    {
                        "tasklist_guid": "cc371766-6584-cf50-a222-c22cd9055004",
                        "section_guid": "e6e37dcc-f75a-5936-f589-12fb4b5c80c2"
                    }
                ],
                "repeat_rule": "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR",
                "parent_task_guid": "e297ddff-06ca-4166-b917-4ce57cd3a7a0",
                "mode": 2,
                "source": 6,
                "custom_complete": {
                    "pc": {
                        "href": "https://www.example.com",
                        "tip": {
                            "en_us": "workbench",
                            "zh_cn": "工作台",
                            "zh_hk": "工作臺",
                            "zh_tw": "工作臺",
                            "ja_jp": "作業台",
                            "fr_fr": "Table de travail",
                            "it_it": "banco di lavoro",
                            "de_de": "Werkbank",
                            "ru_ru": "верстак",
                            "th_th": "โต๊ะทำงาน",
                            "es_es": "banco de trabajo",
                            "ko_kr": "작업대"
                        }
                    },
                    "ios": {
                        "href": "https://www.example.com",
                        "tip": {
                            "en_us": "workbench",
                            "zh_cn": "工作台",
                            "zh_hk": "工作臺",
                            "zh_tw": "工作臺",
                            "ja_jp": "作業台",
                            "fr_fr": "Table de travail",
                            "it_it": "banco di lavoro",
                            "de_de": "Werkbank",
                            "ru_ru": "верстак",
                            "th_th": "โต๊ะทำงาน",
                            "es_es": "banco de trabajo",
                            "ko_kr": "작업대"
                        }
                    },
                    "android": {
                        "href": "https://www.example.com",
                        "tip": {
                            "en_us": "workbench",
                            "zh_cn": "工作台",
                            "zh_hk": "工作臺",
                            "zh_tw": "工作臺",
                            "ja_jp": "作業台",
                            "fr_fr": "Table de travail",
                            "it_it": "banco di lavoro",
                            "de_de": "Werkbank",
                            "ru_ru": "верстак",
                            "th_th": "โต๊ะทำงาน",
                            "es_es": "banco de trabajo",
                            "ko_kr": "작업대"
                        }
                    }
                },
                "task_id": "t6272302",
                "created_at": "1675742789470",
                "updated_at": "1675742789470",
                "status": "todo",
                "url": "https://applink.feishu.cn/client/todo/detail?guid=70577c8f-91ab-4c91-b359-a21a751054e8&suite_entity_num=t192012",
                "start": {
                    "timestamp": "1675454764000",
                    "is_all_day": true
                },
                "subtask_count": 1,
                "is_milestone": false,
                "custom_fields": [
                    {
                        "guid": "a4f648d7-76ef-477f-bc8e-0601b5a60093",
                        "type": "number",
                        "number_value": "10.23",
                        "datetime_value": "1687708260000",
                        "member_value": [
                            {
                                "id": "ou_2cefb2f014f8d0c6c2d2eb7bafb0e54f",
                                "type": "user",
                                "role": "editor"
                            }
                        ],
                        "single_select_value": "4216f79b-3fda-4dc6-a0c4-a16022e47152",
                        "multi_select_value": [
                            "4216f79b-3fda-4dc6-a0c4-a16022e47152"
                        ],
                        "name": "优先级"
                    }
                ],
                "dependencies": [
                    {
                        "type": "next",
                        "task_guid": "93b7bd05-35e6-4371-b3c9-6b7cbd7100c0"
                    }
                ]
            }
        ],
        "page_token": "aWQ9NzEwMjMzMjMxMDE=",
        "has_more": true
    }
}
```

### 错误码

HTTP状态码 | 错误码 | 描述 | 排查建议
---|---|---|---
400 | 1470400 | 请求参数有误，比如page_size填写负数。 | 错误原因见返回的msg提示的信息。
500 | 1470500 | 服务器错误。 | 尝试重试调用。如持续失败，请联系支持人员进行反馈。

