# 说明

新建任务,返回新建任务的数据

# SDK 方法名

nodeJs:

SDK使用方式 (opens new window)

插件中使用SDK

方法名::

addTask
1

# url

https://api.tapd.cn/tasks

# 支持格式

JSON/XML(默认JSON格式)

# HTTP请求方式

POST

# 请求数限制

一次插入一条数据

# 请求参数

字段名 必选 类型及范围 说明
workspace_id integer 项目ID
name string 任务标题
description string 任务详细描述
creator string 创建人
owner string 任务当前处理人
cc string 抄送人
begin date 预计开始
due date 预计结束
story_id integer 关联需求的ID
iteration_id integer 所属迭代的ID
priority string 优先级。为了兼容自定义优先级,请使用 priority_label 字段,详情参考:如何兼容自定义优先级
priority_label string 优先级。推荐使用这个字段
effort string 预估工时
label string 标签,标签不存在时将自动创建,多个以英文坚线分格
cus_{$自定义字段别名} string 自定义字段值,参数名会由后台自动转义为custom_field_*,如:cus_自定义字段的名称
custom_field_* string或者integer 自定义字段参数,具体字段名通过接口 获取任务自定义字段配置 获取

# 调用示例及返回结果

# 在项目下创建任务

# curl 使用 Basic Auth 鉴权调用示例

curl -u 'api_user:api_password' -d 'name=task_created_by_api&workspace_id=10158231&cus_自定义字段的名称=custom_field_value' 'https://api.tapd.cn/tasks'

# 返回结果

{
    "status": 1,
    "data": {
        "Task": {
            "id": "1010158231500600411",
            "name": "task_created_by_api",
            "description": null,
            "workspace_id": "10158231",
            "creator": "api_doc_oauth",
            "created": "2019-06-27 11:02:14",
            "modified": "2019-06-27 11:02:14",
            "status": null,
            "owner": null,
            "cc": null,
            "begin": null,
            "due": null,
            "story_id": "0",
            "iteration_id": "0",
            "priority": "",
            "progress": "0",
            "completed": null,
            "effort_completed": "0",
            "exceed": "0",
            "remain": "0",
            "effort": "0",
            "label": "阻塞|延期",
            "cus_自定义字字段的名称": "custom_field_value",
            "custom_field_one": null,
            "custom_field_two": null,
            "custom_field_three": null,
            "custom_field_four": null,
            "custom_field_five": null,
            "custom_field_six": null,
            "custom_field_seven": null,
            "custom_field_eight": null
        }
    },
    "info": "success"
}
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

# 任务字段说明

# 任务重要字段说明

字段 说明
id id
name 任务标题
description 任务详细描述
workspace_id 项目ID
creator 创建人
created 创建时间
modified 最后修改时间
status 状态
owner 任务当前处理人
cc 抄送人
begin 预计开始
due 预计结束
story_id 关联需求的ID
iteration_id 所属迭代的ID
priority 优先级
priority_label 优先级
progress 进度
completed 完成时间
effort_completed 完成工时
exceed 超出工时
remain 剩余工时
effort 预估工时

# 任务状态(status)取值字段说明

取值 字面值
open 未开始
progressing 进行中
done 已完成

# 任务优先级(priority)取值字段说明

为了兼容自定义优先级,请使用 priority_label 字段,详情参考:如何兼容自定义优先级下面取值将不再使用

取值 字面值
4 High
3 Middle
2 Low
1 Nice To Have
上次更新: 2024-06-13 11:22:44