
Tapd Openapi
- 8 installs
- 33 repo stars
- Updated April 26, 2026
- bighardperson/computer-science-skills-collection
TAPD OpenAPI is a Claude Code skill that operates the TAPD project-management platform via its HTTP API to manage stories, bugs, tasks, iterations, wiki, comments, timesheets, and attachments.
About
TAPD OpenAPI is a Claude Code skill that operates the TAPD project-management platform through its HTTP API. It covers requirements (stories), bugs, tasks, iterations, wiki (with local full-text search), comments, timesheets, and attachments, driven by bundled reference docs and Bearer-token curl templates. A developer uses it to query, create, update, or roll up TAPD items from an agent, including across multiple workspaces.
- Wraps the TAPD OpenAPI for stories, bugs, tasks, iterations, wiki, comments, timesheets, and attachments
- Uses bundled per-service API reference docs and Bearer-token curl templates
- Handles multiple workspaces via TAPD_WORKSPACE_IDS with per-ID aggregation
Tapd Openapi by the numbers
- 8 all-time installs (skills.sh)
- Ranked #2,242 of 3,280 Productivity & Planning skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
tapd-openapi capabilities & compatibility
Free skill; requires a TAPD account, API endpoint, and token
- Capabilities
- project management · planning
- Use cases
- project management · planning
- Runs
- Runs locally
- Pricing
- Bring your own API key
- Requires keys
- TAPD_TOKEN
What tapd-openapi says it does
TAPD OpenAPI skill,用于需求、缺陷、任务、迭代、Wiki、评论、工时、附件等 TAPD 平台操作。
TAPD API 不支持 Wiki 全文搜索,通过本地脚本实现。
`TAPD_TOKEN` - 认证 Token(Bearer 方式)
npx skills add https://github.com/bighardperson/computer-science-skills-collection --skill tapd-openapiAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 8 |
|---|---|
| repo stars | ★ 33 |
| Last updated | April 26, 2026 |
| Repository | bighardperson/computer-science-skills-collection ↗ |
What it does
Query, create, and update TAPD stories, bugs, tasks, iterations, and wiki via its OpenAPI.
Who is it for?
Automating TAPD story/bug/task/iteration and timesheet operations from an agent, including multi-workspace rollups.
Skip if: Non-TAPD trackers like Jira or Linear, or platforms without a TAPD token configured.
When should I use this skill?
A user references TAPD, or needs to query, create, update, or count stories, bugs, tasks, iterations, or wiki.
What you get
Programmatic create/query/update/rollup of TAPD work items through authenticated API calls.
By the numbers
- covers 9 TAPD service groups (stories, bugs, iterations, tasks, comments, wikis, timesheets, attachments, users)
Files
TAPD OpenAPI
环境变量(已预置)
TAPD_API_ENDPOINT- API 地址, 如果TAPD_API_ENDPOINT已配置,则优先使用TAPD_API_ENDPOINT的替换文档中的${TAPD_API_ENDPOINT}TAPD_WORKSPACE_IDS- 项目 ID 列表,逗号分隔,优先级高于TAPD_WORKSPACE_IDTAPD_WORKSPACE_ID- 单个项目 ID(兼容旧配置)TAPD_TOKEN- 认证 Token(Bearer 方式)
Workspace 处理规则
调用前必须先确定实际使用的 workspace 列表:
# 优先取 TAPD_WORKSPACE_IDS,回退到 TAPD_WORKSPACE_ID
if [ -n "$TAPD_WORKSPACE_IDS" ]; then
WS_LIST=$(echo "$TAPD_WORKSPACE_IDS" | tr ',' ' ')
else
WS_LIST="$TAPD_WORKSPACE_ID"
fi- 若
WS_LIST只有一个 ID,按单 workspace 正常请求即可 - 若有多个 ID,需对每个 ID 分别调用 API,再汇总结果(求和、合并列表等,根据用户意图决定)
- 注意 curl 的时候 workspace_id 用逗号分隔后的,例如 $TAPD_WORKSPACE_IDS 是 "31372104,68119668",则 curl 的时候需要分别调用
workspace_id=31372104和workspace_id=68119668
请求模板
# GET
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/${path}?workspace_id=${ws_id}"
# POST
curl -s -X POST -H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/${path}" \
-d '{"workspace_id":"'"${ws_id}"'","key":"value"}'查询 API 文档
API 文档位于 ~/.codebuddy/skills/tapd-openapi/references/ 目录。
1. 列出所有服务:
ls ~/.codebuddy/skills/tapd-openapi/references/2. 列出服务下的 API:
ls ~/.codebuddy/skills/tapd-openapi/references/stories/3. 查看 API 详情:
cat ~/.codebuddy/skills/tapd-openapi/references/stories/liststories.md常用服务
| 服务 | 说明 | 常用 API 文件 |
|---|---|---|
| stories | 需求管理 | liststories, countstories, addstory, updatestory, getrelatedbugs, getstoryfieldsinfo |
| bugs | 缺陷管理 | listbugs, countbugs, addbug, updatebug, getbugfieldsinfo |
| iterations | 迭代管理 | listiterations |
| tasks | 任务管理 | listtasks, counttasks, addtask, updatetask |
| comments | 评论管理 | listcomments, countcomments, addcomment |
| wikis | Wiki 管理 | listwikis, countwikis, addwiki, updatewiki, searchwiki(见下方) |
| timesheets | 工时花费 | listtimesheets, counttimesheets, addtimesheet, updatetimesheet |
| attachments | 附件管理 | listattachments, downloadattachment, getimage, downloaddocument |
| users | 用户信息 | getuserinfo, listworkspaces |
调用流程
1. 确定服务:根据需求从常用服务中选择,或用 ls 查看全部 2. 查找 API:用 ls ~/.codebuddy/skills/tapd-openapi/references/{服务}/ 找到具体操作 3. 获取详情:用 cat 读取 API 文档,获取请求方法、路径、参数 4. 执行请求:按模板构造 curl 命令,workspace_id 必传
Wiki 搜索
TAPD API 不支持 Wiki 全文搜索,通过本地脚本实现。详见:
cat ~/.codebuddy/skills/tapd-openapi/references/wikis/searchwiki.md{
"name": "TAPD",
"installedAt": 1776152028925,
"source": "marketplace",
"iconSource": "tapd-openapi",
"version": "1.0"
}{
"hooks": {
"PreToolUse": [
{
"matcher": "(?i)(tapd|需求|story|stories|缺陷|bug|任务|task|迭代|iteration|sprint|工时|effort|需求分类|category|发布计划|release|自定义字段|custom_field|工作项|workitem|优先级|priority|处理人|owner|业务价值|business_value|wiki.*搜索|搜索.*wiki|查找.*wiki|wiki.*search|search.*wiki|知识库.*搜索|搜索.*知识库|查询.*wiki|wiki.*内容)",
"hooks": [
{
"type": "prompt",
"prompt": "用户的请求涉及 TAPD 平台相关操作。请使用 tapd-openapi 技能来查询和调用 TAPD API。如果涉及 Wiki 搜索,请使用 scripts/search_wiki.py 先同步再搜索。"
}
]
}
]
}
}
TAPD OPENAPI SKILL
功能特性
- 需求管理 — 查询、统计 TAPD 需求(Stories)
- 缺陷管理 — 查询、统计 TAPD 缺陷(Bugs)
- 任务管理 — 查询 TAPD 任务(Tasks)
- 迭代管理 — 查询 TAPD 迭代(Iterations)信息
- Wiki 管理 — 查询、统计 TAPD Wiki 文档
- 问题解答 — 综合 TAPD 数据回答用户问题
使用前配置
使用前至少需要配置以下环境变量:
TAPD_TOKEN:必填,TAPD OpenAPI 的认证 TokenTAPD_WORKSPACE_IDS:建议配置,TAPD 项目 ID 列表,多个项目用英文逗号分隔
可选环境变量:
TAPD_API_ENDPOINT:TAPD API 地址TAPD_WORKSPACE_ID:单个 TAPD 项目 ID,兼容旧配置
说明:
TAPD_WORKSPACE_IDS优先级高于TAPD_WORKSPACE_ID
DownloadAttachment
接口描述
获取单个附件下载链接。每次只能请求一个附件的下载链接,下载链接默认有效时间300秒。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/attachments/down
支持格式: JSON/XML(默认 JSON)
请求数限制: 每次只能请求一个附件的下载链接。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| id | 是 | integer | 附件ID |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/attachments/down?workspace_id=$TAPD_WORKSPACE_ID&id=1210104801000028203'返回示例
{
"status": 1,
"data": {
"Attachment": {
"id": "1210104801000028203",
"type": "wiki_description",
"entry_id": "6100014242115511668",
"filename": "OneDrive.mp4",
"description": null,
"content_type": "video/mp4",
"created": "2021-04-08 15:51:27",
"workspace_id": "10104801",
"owner": "anyechen",
"download_url": "https://..."
}
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | 附件ID |
| type | 业务对象类型 |
| entry_id | 业务对象的ID |
| filename | 文件名 |
| description | 附件描述 |
| content_type | 文件类型 |
| created | 创建时间 |
| workspace_id | 项目ID |
| owner | 附件上传人 |
| download_url | 下载链接(有效时间300秒) |
DownloadDocument
接口描述
获取单个文档下载链接。每次只能获取一个文档下载链接。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/documents/down
支持格式: JSON/XML(默认 JSON)
请求数限制: 每次只能获取一个文档下载链接。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| id | 是 | integer | 文档ID |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/documents/down?workspace_id=$TAPD_WORKSPACE_ID&id=1010104801001648871'返回示例
{
"status": 1,
"data": {
"Document": {
"id": "1010104801001648871",
"workspace_id": "10104801",
"name": "报告标题.docx",
"type": "",
"folder_id": "1010104801000035293",
"creator": "anyechen",
"modifier": "anyechen",
"status": null,
"created": "2021-12-24 16:40:36",
"modified": "2021-12-24 16:40:36",
"download_url": "https://..."
}
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | 文档ID |
| workspace_id | 项目ID |
| name | 标题 |
| type | 文档类型 |
| folder_id | 文件夹ID |
| creator | 创建人 |
| modifier | 最后修改人 |
| created | 创建时间 |
| modified | 最后修改时间 |
| download_url | 下载链接 |
GetImage
接口描述
获取单个图片下载链接。每次只能请求一张图片的下载链接,下载链接默认有效时间300秒。文件名后缀仅限 png、gif、jpg、jpeg、bmp。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/files/get_image
支持格式: JSON/XML(默认 JSON)
请求数限制: 每次只能请求一张图片的下载链接。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| image_path | 是 | string | 图片路径,支持完整url地址,图片所属项目必须和传入的项目ID一致 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/files/get_image?workspace_id=$TAPD_WORKSPACE_ID&image_path=/tfl/captures/2023-07/tapd_10104801_base64_1689686020_146.png'返回示例
{
"status": 1,
"data": {
"Image": {
"workspace_id": "10104801",
"filename": "tapd_10104801_base64_1689686020_146.png",
"type": "png",
"value": "/tfl/captures/2023-07/tapd_10104801_base64_1689686020_146.png",
"download_url": "https://file.tapd.cn/attachments/tmp_download/..."
}
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| workspace_id | 项目ID |
| filename | 图片文件名 |
| type | 文件类型 |
| value | 图片路径 |
| download_url | 单个图片下载地址(有效时间300秒) |
ListAttachments
接口描述
返回符合查询条件的所有附件(分页显示,默认一页30条)。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/attachments
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回30条,可通过 limit 参数设置,最大200。也可传 page 参数翻页。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | |
| type | 否 | string | 类型 | |
| entry_id | 否 | integer | 依赖对象ID | |
| filename | 否 | string | 附件名称 | |
| owner | 否 | string | 上传人 | |
| limit | 否 | integer | 返回数量限制,默认30 | |
| page | 否 | integer | 页码,默认1 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/attachments?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": [
{
"Attachment": {
"id": "1210104801000028203",
"type": "wiki_description",
"entry_id": "6100014242115511668",
"filename": "OneDrive.mp4",
"content_type": "video/mp4",
"created": "2020-08-25 11:24:44",
"workspace_id": "10104801",
"owner": "anyechen"
}
}
],
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | 附件ID |
| type | 类型 |
| entry_id | 依赖对象ID |
| filename | 附件名称 |
| content_type | 内容类型 |
| created | 创建时间 |
| workspace_id | 项目ID |
| owner | 上传人 |
AddBug
接口描述
在项目下创建一条缺陷(Bug),一次只能插入一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/bugs
支持格式: JSON/XML(默认 JSON)
请求数限制: 一次插入一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| title | 是 | string | 缺陷标题 |
| priority_label | 否 | string | 优先级(推荐),如 urgent / high / medium / low |
| priority | 否 | string | 优先级(已废弃,请用 priority_label) |
| severity | 否 | string | 严重程度:fatal / serious / normal / prompt / advice |
| module | 否 | string | 模块 |
| feature | 否 | string | 特性 |
| release_id | 否 | integer | 发布计划 |
| version_report | 否 | string | 发现版本 |
| version_test | 否 | string | 验证版本 |
| version_fix | 否 | string | 合入版本 |
| version_close | 否 | string | 关闭版本 |
| baseline_find | 否 | string | 发现基线 |
| baseline_join | 否 | string | 合入基线 |
| baseline_test | 否 | string | 验证基线 |
| baseline_close | 否 | string | 关闭基线 |
| current_owner | 否 | string | 处理人 |
| template_id | 否 | integer | 模板ID |
| cc | 否 | string | 抄送人 |
| reporter | 否 | string | 创建人 |
| participator | 否 | string | 参与人 |
| te | 否 | string | 测试人员 |
| de | 否 | string | 开发人员 |
| auditer | 否 | string | 审核人 |
| confirmer | 否 | string | 验证人 |
| fixer | 否 | string | 修复人 |
| closer | 否 | string | 关闭人 |
| begin | 否 | date | 预计开始(格式:YYYY-MM-DD) |
| due | 否 | date | 预计结束(格式:YYYY-MM-DD) |
| deadline | 否 | date | 解决期限(格式:YYYY-MM-DD) |
| iteration_id | 否 | string | 迭代ID |
| size | 否 | string | 规模 |
| os | 否 | string | 操作系统 |
| platform | 否 | string | 软件平台 |
| testmode | 否 | string | 测试方式 |
| testphase | 否 | string | 测试阶段 |
| testtype | 否 | string | 测试类型 |
| source | 否 | string | 缺陷根源 |
| bugtype | 否 | string | 缺陷类型 |
| frequency | 否 | string | 重现规律 |
| originphase | 否 | string | 发现阶段 |
| sourcephase | 否 | string | 引入阶段 |
| resolution | 否 | string | 解决方法(见候选值) |
| estimate | 否 | integer | 预计解决时间 |
| description | 否 | string | 详细描述(支持 HTML) |
| label | 否 | string | 标签,多个用英文竖线分隔,不存在时自动创建 |
| effort | 否 | integer | 预估工时 |
| is_apply_template_default_value | 否 | integer | 传 1 则从模板继承默认值 |
| custom_field_* | 否 | string/integer | 自定义字段,具体字段名通过「获取缺陷自定义字段配置」接口获取 |
| custom_plan_field_* | 否 | string/integer | 自定义计划应用参数 |
| cus_{自定义字段别名} | 否 | string | 自定义字段(后台自动转义为 custom_field_*) |
常用字段候选值
severity(严重程度)
| 取值 | 说明 |
|---|---|
| fatal | 致命 |
| serious | 严重 |
| normal | 一般 |
| prompt | 提示 |
| advice | 建议 |
resolution(解决方法)
| 取值 | 说明 |
|---|---|
| fixed | 已解决 |
| ignore | 无需解决 |
| duplicated | 重复 |
| failed | 无法重现 |
| intentional | 设计如此 |
| external | 外部原因 |
| feature | 需求变更 |
| hold | 挂起 |
请求示例
# 创建最简缺陷
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/bugs" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"title": "缺陷标题"
}'
# 创建带完整信息的缺陷
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/bugs" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"title": "登录页面崩溃",
"priority_label": "high",
"severity": "serious",
"current_owner": "username",
"description": "<div>复现步骤:...</div>",
"deadline": "2026-03-20",
"iteration_id": "迭代ID"
}'返回示例
{
"status": 1,
"data": {
"Bug": {
"id": "1010158231500643487",
"title": "缺陷标题",
"workspace_id": "10158231",
"status": "new",
"reporter": "api_doc_oauth",
"severity": "",
"priority": "",
"current_owner": null,
"iteration_id": "0",
"created": "2019-06-27 14:19:47",
"modified": "2019-06-27 14:19:47",
"created_from": "api"
}
},
"info": "success"
}注意事项
priority字段已废弃,请统一使用priority_labelstatus/module/iteration_id等动态字段的可选值需通过「获取缺陷所有字段及候选值」接口获取label中不存在的标签会自动创建,多个标签用英文竖线|分隔description支持 HTML 富文本格式
CountBugs
接口描述
计算符合查询条件的缺陷数量并返回。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/bugs/count
支持格式: JSON/XML(默认 JSON)
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询 |
| title | 否 | string | 标题 | 支持模糊匹配 |
| priority | 否 | string | 优先级。推荐使用 priority_label | |
| priority_label | 否 | string | 优先级(推荐) | |
| severity | 否 | string | 严重程度 | 支持枚举查询 |
| status | 否 | string | 状态 | 支持不等于查询、枚举查询 |
| label | 否 | string | 标签查询 | 支持枚举查询 |
| iteration_id | 否 | integer | 迭代 | |
| module | 否 | string | 模块 | 支持枚举查询 |
| release_id | 否 | integer | 发布计划 | |
| version_report | 否 | string | 发现版本 | 枚举查询 |
| version_test | 否 | string | 验证版本 | |
| version_fix | 否 | string | 合入版本 | |
| version_close | 否 | string | 关闭版本 | |
| baseline_find | 否 | string | 发现基线 | |
| baseline_join | 否 | string | 合入基线 | |
| baseline_test | 否 | string | 验证基线 | |
| baseline_close | 否 | string | 关闭基线 | |
| current_owner | 否 | string | 处理人 | 支持模糊匹配 |
| cc | 否 | string | 抄送人 | |
| reporter | 否 | string | 创建人 | |
| participator | 否 | string | 参与人 | 支持多人员查询 |
| te | 否 | string | 测试人员 | 支持模糊匹配 |
| de | 否 | string | 开发人员 | 支持模糊匹配 |
| auditer | 否 | string | 审核人 | |
| confirmer | 否 | string | 验证人 | |
| fixer | 否 | string | 修复人 | |
| closer | 否 | string | 关闭人 | |
| lastmodify | 否 | string | 最后修改人 | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| in_progress_time | 否 | datetime | 接受处理时间 | 支持时间查询 |
| resolved | 否 | datetime | 解决时间 | 支持时间查询 |
| verify_time | 否 | datetime | 验证时间 | 支持时间查询 |
| closed | 否 | datetime | 关闭时间 | 支持时间查询 |
| reject_time | 否 | datetime | 拒绝时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | 支持时间查询 |
| begin | 否 | date | 预计开始 | |
| due | 否 | date | 预计结束 | |
| deadline | 否 | date | 解决期限 | |
| os | 否 | string | 操作系统 | |
| platform | 否 | string | 软件平台 | |
| testmode | 否 | string | 测试方式 | |
| testphase | 否 | string | 测试阶段 | |
| testtype | 否 | string | 测试类型 | |
| source | 否 | string | 缺陷根源 | 支持枚举查询 |
| bugtype | 否 | string | 缺陷类型 | |
| frequency | 否 | string | 重现规律 | 支持枚举查询 |
| originphase | 否 | string | 发现阶段 | |
| sourcephase | 否 | string | 引入阶段 | |
| resolution | 否 | string | 解决方法 | 支持枚举查询 |
| estimate | 否 | integer | 预计解决时间 | |
| description | 否 | string | 详细描述 | 支持模糊匹配 |
| effort | 否 | integer | 预估工时 | |
| custom_field_* | 否 | string/integer | 自定义字段参数 | 支持枚举查询 |
| custom_plan_field_* | 否 | string/integer | 自定义计划应用参数 |
请求示例
# 获取项目下的缺陷数量
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/bugs/count?workspace_id=$TAPD_WORKSPACE_ID'
# 获取指定处理人、高优先级、状态为新的缺陷数量
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/bugs/count?workspace_id=$TAPD_WORKSPACE_ID¤t_owner=anyechen&priority=high&status=new'返回示例
{
"status": 1,
"data": {
"count": 2
},
"info": "success"
}GetBugFieldsInfo
接口描述
返回缺陷所有字段及候选值(枚举值),即通常理解的字段的"英文Key"和"中文值"。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/bugs/get_fields_info
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回所有数据。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| all_options | 否 | integer | 是否也返回已关闭的选项。1 返回,默认 0 不返回,与 TAPD 界面对齐 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/bugs/get_fields_info?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": {
"status": {
"name": "status",
"label": "状态",
"options": {
"new": "新",
"in_progress": "接受/处理",
"resolved": "已解决",
"closed": "已关闭"
},
"pure_options": [],
"html_type": "select",
"memo": ""
},
"priority": {
"name": "priority",
"label": "优先级",
"options": {
"urgent": "紧急",
"high": "高",
"medium": "中",
"low": "低",
"insignificant": "无关紧要"
},
"pure_options": [],
"html_type": "select",
"memo": ""
},
"severity": {
"name": "severity",
"label": "严重程度",
"options": {
"fatal": "致命",
"serious": "严重",
"normal": "一般",
"prompt": "提示",
"advice": "建议"
},
"pure_options": [],
"html_type": "select",
"memo": ""
}
},
"info": "success"
}返回格式说明
| 字段 | 说明 |
|---|---|
| name | 字段英文名 |
| label | 字段中文名称 |
| options | 候选值(英文Key → 中文值) |
| html_type | 字段类型(select、input、text、datetime、user_chooser 等) |
包含候选值的字段
| 字段 | 说明 |
|---|---|
| status | 状态枚举值(每个项目可单独配置,无固定映射,只能通过此接口获取) |
| priority | 优先级枚举值 |
| severity | 严重程度枚举值 |
| resolution | 解决方法枚举值 |
| iteration_id | 迭代枚举值 |
| module | 模块枚举值 |
| release_id | 发布计划枚举值 |
| version_report | 发现版本枚举值 |
| version_test | 验证版本枚举值 |
| version_fix | 合入版本枚举值 |
| version_close | 关闭版本枚举值 |
| platform | 软件平台枚举值 |
| os | 操作系统枚举值 |
| testmode | 测试方式枚举值 |
| testtype | 测试类型枚举值 |
| testphase | 测试阶段枚举值 |
| source | 缺陷根源枚举值 |
| bugtype | 缺陷类型枚举值 |
| frequency | 重现规律枚举值 |
| originphase | 发现阶段枚举值 |
| sourcephase | 引入阶段枚举值 |
| custom_field_* | 自定义字段枚举值 |
缺陷严重程度 (severity) 可选值
| 取值 | 字面值 |
|---|---|
| fatal | 致命 |
| serious | 严重 |
| normal | 一般 |
| prompt | 提示 |
| advice | 建议 |
缺陷解决方法 (resolution) 可选值
| 取值 | 字面值 |
|---|---|
| ignore | 无需解决 |
| fixed | 已修改 |
| fix later | 延期解决 |
| failed to recur | 无法重现 |
| external reason | 外部原因 |
| duplicated | 重复 |
| intentional design | 设计如此 |
| unclear description | 问题描述不准确 |
| feature change | 需求变更 |
| transferred to story | 已转需求 |
| hold | 挂起 |
特殊说明
- 状态 (status):支持每个项目单独配置,没有固定的中英文映射,只能通过此接口获取。
- 优先级 (priority):为了兼容自定义优先级,请使用
priority_label字段。
ListBugs
接口描述
返回符合查询条件的所有缺陷(分页显示,默认一页30条)。
状态查询注意事项 : 按状态查询时,建议使用v_status参数直接传中文状态名(如v_status=新)。因为缺陷状态的英文 Key 是每个项目单独配置的,使用中文名更直观、不易出错。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/bugs
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回30条,可通过 limit 参数设置,最大200。也可传 page 参数翻页。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询 |
| title | 否 | string | 标题 | 支持模糊匹配 |
| priority | 否 | string | 优先级。推荐使用 priority_label | |
| priority_label | 否 | string | 优先级(推荐) | |
| severity | 否 | string | 严重程度 | 支持枚举查询 |
| status | 否 | string | 状态 | 支持不等于查询、枚举查询 |
| v_status | 否 | string | 状态(支持传入中文状态名称) | |
| label | 否 | string | 标签查询 | 支持枚举查询 |
| iteration_id | 否 | string | 迭代 | 支持枚举查询 |
| module | 否 | string | 模块 | 支持枚举查询 |
| release_id | 否 | integer | 发布计划 | |
| version_report | 否 | string | 发现版本 | 枚举查询 |
| version_test | 否 | string | 验证版本 | |
| version_fix | 否 | string | 合入版本 | |
| version_close | 否 | string | 关闭版本 | |
| baseline_find | 否 | string | 发现基线 | |
| baseline_join | 否 | string | 合入基线 | |
| baseline_test | 否 | string | 验证基线 | |
| baseline_close | 否 | string | 关闭基线 | |
| feature | 否 | string | 特性 | |
| current_owner | 否 | string | 处理人 | 支持模糊匹配 |
| cc | 否 | string | 抄送人 | |
| reporter | 否 | string | 创建人 | 支持多人员查询 |
| participator | 否 | string | 参与人 | 支持多人员查询 |
| te | 否 | string | 测试人员 | 支持模糊匹配 |
| de | 否 | string | 开发人员 | 支持模糊匹配 |
| auditer | 否 | string | 审核人 | |
| confirmer | 否 | string | 验证人 | |
| fixer | 否 | string | 修复人 | |
| closer | 否 | string | 关闭人 | |
| lastmodify | 否 | string | 最后修改人 | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| in_progress_time | 否 | datetime | 接受处理时间 | 支持时间查询 |
| resolved | 否 | datetime | 解决时间 | 支持时间查询 |
| verify_time | 否 | datetime | 验证时间 | 支持时间查询 |
| closed | 否 | datetime | 关闭时间 | 支持时间查询 |
| reject_time | 否 | datetime | 拒绝时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | 支持时间查询 |
| begin | 否 | date | 预计开始 | |
| due | 否 | date | 预计结束 | |
| deadline | 否 | date | 解决期限 | |
| os | 否 | string | 操作系统 | |
| size | 否 | string | 规模 | |
| platform | 否 | string | 软件平台 | |
| testmode | 否 | string | 测试方式 | |
| testphase | 否 | string | 测试阶段 | |
| testtype | 否 | string | 测试类型 | |
| source | 否 | string | 缺陷根源 | 支持枚举查询 |
| bugtype | 否 | string | 缺陷类型 | |
| frequency | 否 | string | 重现规律 | 支持枚举查询 |
| originphase | 否 | string | 发现阶段 | |
| sourcephase | 否 | string | 引入阶段 | |
| resolution | 否 | string | 解决方法 | 支持枚举查询 |
| estimate | 否 | integer | 预计解决时间 | |
| description | 否 | string | 详细描述 | 支持模糊匹配 |
| custom_field_* | 否 | string/integer | 自定义字段参数 | 支持枚举查询 |
| custom_plan_field_* | 否 | string/integer | 自定义计划应用参数 | |
| limit | 否 | integer | 返回数量限制,默认30,最大200 | |
| page | 否 | integer | 页码,默认1 | |
| order | 否 | string | 排序规则,如 created%20desc | |
| fields | 否 | string | 返回字段,逗号分隔 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/bugs?workspace_id=$TAPD_WORKSPACE_ID&limit=2'返回示例
{
"status": 1,
"data": [
{
"Bug": {
"id": "1010158231500628817",
"title": "【示例】新官网Chrome浏览器兼容性bug",
"description": null,
"priority": "high",
"severity": "prompt",
"module": null,
"status": "in_progress",
"reporter": "anyechen",
"deadline": null,
"created": "2017-06-20 16:49:19",
"bugtype": "",
"resolved": null,
"closed": null,
"modified": "2018-01-12 14:45:27",
"lastmodify": "anyechen",
"auditer": null,
"de": null,
"fixer": null,
"version_test": "",
"version_report": "版本1",
"version_close": "",
"version_fix": "",
"baseline_find": "",
"baseline_join": "",
"baseline_close": "",
"baseline_test": "",
"sourcephase": "",
"te": null,
"current_owner": null,
"iteration_id": "0",
"resolution": "",
"source": "",
"originphase": "",
"confirmer": null,
"milestone": null,
"participator": null,
"closer": null,
"platform": "",
"os": "",
"testtype": "",
"testphase": "",
"frequency": "",
"cc": null,
"regression_number": "0",
"flows": "new",
"feature": null,
"testmode": "",
"estimate": null,
"issue_id": null,
"created_from": null,
"in_progress_time": null,
"verify_time": null,
"reject_time": null,
"reopen_time": null,
"audit_time": null,
"suspend_time": null,
"due": null,
"begin": null,
"release_id": null,
"label": "阻塞|重点关注",
"custom_field_one": "",
"custom_field_two": "",
"custom_field_three": "",
"custom_field_four": "",
"custom_field_five": "",
"workspace_id": "10158231"
}
}
],
"info": "success"
}UpdateBug
接口描述
更新缺陷,返回缺陷更新后的数据。每次只允许更新一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/bugs
支持格式: JSON/XML(默认 JSON)
请求数限制: 每次只允许更新一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| id | 是 | integer | 缺陷ID |
| workspace_id | 是 | integer | 项目ID |
| title | 否 | string | 标题 |
| priority_label | 否 | string | 优先级(推荐),如 urgent / high / medium / low |
| priority | 否 | string | 优先级(已废弃,请用 priority_label) |
| severity | 否 | string | 严重程度:fatal / serious / normal / prompt / advice |
| status | 否 | string | 状态 |
| v_status | 否 | string | 状态(支持传入中文状态名称) |
| module | 否 | string | 模块 |
| feature | 否 | string | 特性 |
| release_id | 否 | integer | 发布计划 |
| version_report | 否 | string | 发现版本 |
| version_test | 否 | string | 验证版本 |
| version_fix | 否 | string | 合入版本 |
| version_close | 否 | string | 关闭版本 |
| baseline_find | 否 | string | 发现基线 |
| baseline_join | 否 | string | 合入基线 |
| baseline_test | 否 | string | 验证基线 |
| baseline_close | 否 | string | 关闭基线 |
| current_owner | 否 | string | 处理人 |
| current_user | 否 | string | 变更人 |
| cc | 否 | string | 抄送人 |
| reporter | 否 | string | 创建人 |
| participator | 否 | string | 参与人 |
| te | 否 | string | 测试人员 |
| de | 否 | string | 开发人员 |
| auditer | 否 | string | 审核人 |
| confirmer | 否 | string | 验证人 |
| fixer | 否 | string | 修复人 |
| closer | 否 | string | 关闭人 |
| begin | 否 | date | 预计开始(格式:YYYY-MM-DD) |
| due | 否 | date | 预计结束(格式:YYYY-MM-DD) |
| deadline | 否 | date | 解决期限(格式:YYYY-MM-DD) |
| os | 否 | string | 操作系统 |
| size | 否 | string | 规模 |
| platform | 否 | string | 软件平台 |
| testmode | 否 | string | 测试方式 |
| testphase | 否 | string | 测试阶段 |
| testtype | 否 | string | 测试类型 |
| source | 否 | string | 缺陷根源 |
| bugtype | 否 | string | 缺陷类型 |
| frequency | 否 | string | 重现规律 |
| originphase | 否 | string | 发现阶段 |
| sourcephase | 否 | string | 引入阶段 |
| resolution | 否 | string | 解决方法(见候选值) |
| estimate | 否 | integer | 预计解决时间 |
| description | 否 | string | 详细描述(支持 HTML) |
| label | 否 | string | 标签,多个用英文竖线分隔,不存在时自动创建 |
| effort | 否 | integer | 预估工时 |
| keep_owner | 否 | integer | 是否保留处理人,传 1 则保留 |
| custom_field_* | 否 | string/integer | 自定义字段,具体字段名通过「获取缺陷自定义字段配置」接口获取 |
| custom_plan_field_* | 否 | string/integer | 自定义计划应用参数 |
| cus_{自定义字段别名} | 否 | string | 自定义字段(后台自动转义为 custom_field_*) |
请求示例
# 更新缺陷处理人
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/bugs" \
-d '{
"id": "缺陷ID",
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"current_owner": "username"
}'
# 更新缺陷状态和解决方法
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/bugs" \
-d '{
"id": "缺陷ID",
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"status": "resolved",
"resolution": "fixed",
"current_user": "username"
}'返回示例
{
"status": 1,
"data": {
"Bug": {
"id": "1010158231500628817",
"title": "【示例】新官网Chrome浏览器兼容性bug",
"workspace_id": "10158231",
"status": "in_progress",
"priority": "high",
"severity": "prompt",
"current_owner": "anyechen;",
"modified": "2019-06-27 14:29:03",
"lastmodify": "anyechen"
}
},
"info": "success"
}注意事项
id和workspace_id为必传字段,其余字段按需传入,未传字段不会被修改priority字段已废弃,请统一使用priority_labelstatus与v_status二选一,v_status支持中文状态名keep_owner=1可在状态流转时保留当前处理人不被重置status/module等动态字段的可选值需通过「获取缺陷所有字段及候选值」接口获取
AddComment
接口描述
在业务对象(需求、缺陷、任务等)下添加一条评论,一次只能插入一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/comments
支持格式: JSON/XML(默认 JSON)
请求数限制: 一次插入一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| description | 是 | string | 内容(必须使用 HTML 富文本,如 <p>内容</p>,markdown 不会正确渲染) |
| author | 是 | string | 评论人 |
| entry_type | 是 | string | 评论类型:bug / bug_remark / stories / tasks |
| entry_id | 是 | integer | 评论所依附的业务对象实体ID |
| root_id | 否 | integer | 根评论ID(回复评论线程时必填) |
| reply_id | 否 | integer | 被回复的评论ID(回复某条评论时必填) |
entry_type 取值说明
| 取值 | 说明 |
|---|---|
| stories | 需求评论 |
| bug | 缺陷评论 |
| bug_remark | 流转缺陷时的评论 |
| tasks | 任务评论 |
@提及(触发通知)
在 description 中使用以下 HTML 标签可触发 @通知:
<b class="at-who" contenteditable="false" data-userid="用户ID" data-type="user">@用户名</b>必需属性:
| 属性 | 值 | 说明 |
|---|---|---|
| class | at-who | 标识 @提及,缺少则不触发通知 |
| contenteditable | false | 编辑器中不可编辑 |
| data-userid | 用户登录名 | 决定通知发给谁 |
| data-type | user | 标识对象类型为用户 |
可同时 @多人,写多个 <b class="at-who" ...> 标签即可。
回复评论
回复某条评论时需同时设置 root_id 和 reply_id:
- 回复根评论:
root_id=reply_id= 被回复评论的 ID - 回复线程中的子评论:
root_id= 线程根评论 ID,reply_id= 被回复的子评论 ID
description 支持的富文本格式
| HTML 标签 | 效果 |
|---|---|
<b> | 加粗 |
<i> | 斜体 |
<u> | 下划线 |
<s> | 删除线 |
<span style="color: red;"> | 颜色文字 |
<ul><li> | 无序列表 |
<ol><li> | 有序列表 |
<pre><code> | 代码块 |
<blockquote> | 引用 |
<a href="..."> | 超链接 |
<table> | 表格 |
请求示例
# 添加简单评论
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
--data-urlencode "workspace_id=$TAPD_WORKSPACE_ID" \
--data-urlencode 'entry_type=stories' \
--data-urlencode 'entry_id=1131372104001000001' \
--data-urlencode 'author=username' \
--data-urlencode 'description=<p>这是一条评论</p>' \
"${TAPD_API_ENDPOINT}/comments"
# 添加带 @提及 的评论
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
--data-urlencode "workspace_id=$TAPD_WORKSPACE_ID" \
--data-urlencode 'entry_type=stories' \
--data-urlencode 'entry_id=1131372104001000001' \
--data-urlencode 'author=username' \
--data-urlencode 'description=<p><b class="at-who" contenteditable="false" data-userid="target_user" data-type="user">@target_user</b> 请看一下这个问题</p>' \
"${TAPD_API_ENDPOINT}/comments"
# 回复某条评论
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
--data-urlencode "workspace_id=$TAPD_WORKSPACE_ID" \
--data-urlencode 'entry_type=stories' \
--data-urlencode 'entry_id=1131372104001000001' \
--data-urlencode 'author=username' \
--data-urlencode 'root_id=1131372104001000040' \
--data-urlencode 'reply_id=1131372104001000040' \
--data-urlencode 'description=<p>这是一条回复评论</p>' \
"${TAPD_API_ENDPOINT}/comments"返回示例
{
"status": 1,
"data": {
"Comment": {
"id": "1020355782058781915",
"title": "在状态 [新] 添加",
"description": "ccc",
"author": "v_xuanfang",
"entry_type": "bug",
"entry_id": "1020355782500647717",
"reply_id": "0",
"root_id": "0",
"created": "2019-12-24 18:33:53",
"modified": "2019-12-24 18:33:53",
"workspace_id": "20355782"
}
},
"info": "success"
}注意事项
- POST 请求建议使用
--data-urlencode传参,避免 HTML 特殊字符编码问题 description必须使用 HTML 格式(如<p>...</p>),传 markdown 不会正确渲染,支持 Emoji- @提及 的
data-userid需要填用户的登录账号名(非昵称) - 回复评论时
root_id和reply_id必须同时提供
CountComments
接口描述
计算符合查询条件的评论数量并返回。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/comments/count
支持格式: JSON/XML(默认 JSON)
请求数限制: 只返回评论数量
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | 评论ID | 支持多ID查询 |
| title | 否 | string | 标题 | |
| description | 否 | string | 内容 | |
| author | 否 | string | 评论人 | |
| entry_type | 否 | string | 评论类型(取值见下方说明,多个类型间以竖线隔开) | 支持枚举查询 |
| entry_id | 否 | integer | 评论所依附的业务对象实体ID | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后更改时间 | 支持时间查询 |
entry_type 取值说明
| 取值 | 说明 |
|---|---|
| stories | 需求评论 |
| bug | 缺陷评论 |
| bug_remark | 流转缺陷时的评论 |
| tasks | 任务评论 |
| wiki | Wiki 评论 |
多个类型间以竖线 | 隔开,如 entry_type=bug|bug_remark。
请求示例
# 获取项目下评论总数
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/comments/count?workspace_id=$TAPD_WORKSPACE_ID"
# 获取某条缺陷的评论数量
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/comments/count?workspace_id=$TAPD_WORKSPACE_ID&entry_type=bug&entry_id=1010104801074085199"
# 获取某用户的评论数量
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/comments/count?workspace_id=$TAPD_WORKSPACE_ID&author=username"返回示例
{
"status": 1,
"data": {
"count": 61
},
"info": "success"
}ListComments
接口描述
返回符合查询条件的所有评论(分页显示,默认一页30条)。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/comments
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回30条,可通过 limit 参数设置,最大200。也可传 page 参数翻页。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | 评论ID | 支持多ID查询 |
| title | 否 | string | 标题 | |
| description | 否 | string | 内容 | |
| author | 否 | string | 评论人 | |
| entry_type | 否 | string | 评论类型(取值见下方说明,多个类型间以竖线隔开) | 支持枚举查询 |
| entry_id | 否 | integer | 评论所依附的业务对象实体ID | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后更改时间 | 支持时间查询 |
| root_id | 否 | integer | 根评论ID | |
| reply_id | 否 | integer | 评论回复的ID | |
| limit | 否 | integer | 返回数量限制,默认30,最大200 | |
| page | 否 | integer | 页码,默认1 | |
| order | 否 | string | 排序规则,如 created%20desc | |
| fields | 否 | string | 返回字段,逗号分隔 |
entry_type 取值说明
| 取值 | 说明 |
|---|---|
| stories | 需求评论 |
| bug | 缺陷评论 |
| bug_remark | 流转缺陷时的评论 |
| tasks | 任务评论 |
| wiki | Wiki 评论 |
多个类型间以竖线 | 隔开,如 entry_type=bug|bug_remark。
请求示例
# 获取项目下所有评论
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/comments?workspace_id=$TAPD_WORKSPACE_ID"
# 获取某条需求的评论
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/comments?workspace_id=$TAPD_WORKSPACE_ID&entry_type=stories&entry_id=1131372104001000001&limit=200"
# 获取某条缺陷的评论(含流转评论)
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/comments?workspace_id=$TAPD_WORKSPACE_ID&entry_type=bug|bug_remark&entry_id=1010104801074085199&limit=200"返回示例
{
"status": 1,
"data": [
{
"Comment": {
"id": "1010104801048492751",
"title": "流转状态从 [规划中] 到 [实现中] 添加",
"description": "<b><i><u>adfasd</u></i></b>",
"author": "v_xuanfang",
"entry_type": "stories",
"entry_id": "1010104801858505231",
"created": "2020-06-09 10:51:06",
"modified": "2020-06-09 10:51:06",
"workspace_id": "10104801"
}
}
],
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | 评论ID |
| title | 标题 |
| description | 内容(HTML 富文本) |
| author | 评论人 |
| entry_type | 评论类型 |
| entry_id | 评论所依附的业务对象实体ID |
| created | 创建时间 |
| modified | 最后更改时间 |
| workspace_id | 项目ID |
| root_id | 根评论ID(0 表示自身为根评论) |
| reply_id | 评论回复的ID(0 表示非回复) |
评论树结构说明
root_id = 0且reply_id = 0:根评论(一级评论)root_id != 0:属于某个评论线程,root_id指向线程的根评论reply_id != 0:回复某条具体评论,reply_id指向被回复的评论
ListIterations
接口描述
返回符合查询条件的所有迭代(分页显示,默认一页30条)。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/iterations
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回30条,可通过 limit 参数设置,最大200。也可传 page 参数翻页。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询 |
| name | 否 | string | 标题 | 支持模糊匹配 |
| description | 否 | string | 详细描述 | |
| startdate | 否 | date | 开始时间 | 支持时间查询 |
| enddate | 否 | date | 结束时间 | 支持时间查询 |
| workitem_type_id | 否 | integer | 迭代类别 | |
| plan_app_id | 否 | integer | 计划应用ID | |
| status | 否 | string | 状态(系统状态open/done,自定义状态可传中文) | |
| creator | 否 | string | 创建人 | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | 支持时间查询 |
| completed | 否 | datetime | 完成时间 | |
| locker | 否 | string | 锁定人 | |
| custom_field_* | 否 | string/integer | 自定义字段参数 | |
| limit | 否 | integer | 返回数量限制,默认30 | |
| page | 否 | integer | 页码,默认1 | |
| order | 否 | string | 排序规则,如 created%20desc | |
| fields | 否 | string | 返回字段,逗号分隔 |
迭代状态(status)字段说明
自定义状态可以直接传中文字符。
| 字段值 | 状态名 |
|---|---|
| open | 开启 |
| done | 已关闭 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/iterations?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": [
{
"Iteration": {
"id": "1010158231000388075",
"name": "迭代2",
"workspace_id": "10158231",
"startdate": "2017-06-26",
"enddate": "2017-07-07",
"status": "open",
"release_id": null,
"description": "熟悉敏捷迭代开发",
"creator": "anyechen",
"created": "2017-06-20 16:49:05",
"modified": "2017-06-20 16:49:05",
"completed": null,
"custom_field_1": null,
"custom_field_2": null,
"custom_field_3": null,
"custom_field_4": null,
"custom_field_5": null
}
}
],
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| name | 标题 |
| workspace_id | 项目ID |
| description | 详细描述 |
| startdate | 开始时间 |
| enddate | 结束时间 |
| status | 状态 |
| creator | 创建人 |
| created | 创建时间 |
| modified | 最后修改时间 |
| completed | 完成时间 |
| lock_info | 锁定内容 |
| locker | 锁定人 |
| workitem_type_id | 迭代类别 |
| plan_app_id | 计划应用ID |
AddStory
接口描述
在项目下创建一条需求(Story),一次只能插入一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/stories
支持格式: JSON/XML(默认 JSON)
请求数限制: 一次插入一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| name | 是 | string | 标题 |
| priority_label | 否 | string | 优先级(推荐),如 High / Middle / Low |
| business_value | 否 | integer | 业务价值 |
| version | 否 | string | 版本 |
| module | 否 | string | 模块 |
| test_focus | 否 | string | 测试重点 |
| size | 否 | integer | 规模 |
| owner | 否 | string | 处理人 |
| cc | 否 | string | 抄送人 |
| creator | 否 | string | 创建人 |
| developer | 否 | string | 开发人员 |
| begin | 否 | date | 预计开始(格式:YYYY-MM-DD) |
| due | 否 | date | 预计结束(格式:YYYY-MM-DD) |
| iteration_id | 否 | string | 迭代ID |
| parent_id | 否 | integer | 父需求ID |
| effort | 否 | string | 预估工时 |
| category_id | 否 | integer | 需求分类 |
| workitem_type_id | 否 | integer | 需求类别 |
| release_id | 否 | integer | 发布计划 |
| source | 否 | string | 来源 |
| type | 否 | string | 类型 |
| feature | 否 | string | 特性 |
| tech_risk | 否 | string | 技术风险 |
| description | 否 | string | 详细描述(支持 HTML) |
| label | 否 | string | 标签,多个用英文竖线分隔,不存在时自动创建 |
| templated_id | 否 | integer | 模板ID |
| is_apply_template_default_value | 否 | integer | 传 1 则从模板继承默认值和保密设置 |
| apply_template | 否 | string | 模板选项,多个用英文逗号分隔,支持 preset_stories / preset_tasks |
| custom_field_* | 否 | string/integer | 自定义字段,具体字段名通过「获取需求自定义字段配置」接口获取 |
| custom_plan_field_* | 否 | string/integer | 自定义计划应用参数 |
| cus_{自定义字段别名} | 否 | string | 自定义字段(后台自动转义为 custom_field_*) |
请求示例
# 创建最简需求
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/stories" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"name": "新需求标题"
}'
# 创建带完整信息的需求
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/stories" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"name": "需求标题",
"priority_label": "High",
"owner": "username",
"description": "<div>详细描述内容</div>",
"begin": "2026-03-10",
"due": "2026-03-31",
"iteration_id": "迭代ID"
}'返回示例
{
"status": 1,
"data": {
"Story": {
"id": "1010104801124922063",
"workitem_type_id": "1010104801000022091",
"name": "新需求标题",
"description": null,
"workspace_id": "10104801",
"creator": "v_xuanfang",
"created": "2025-06-16 14:42:59",
"modified": "2025-06-16 14:42:59",
"status": "planning",
"owner": "",
"iteration_id": "0",
"parent_id": "0",
"category_id": "-1",
"label": "",
"progress": "0",
"created_from": "api"
}
},
"info": "success"
}注意事项
priority字段已废弃,请统一使用priority_labelstatus/module/iteration_id等动态字段的可选值需通过「获取需求所有字段及候选值」接口获取label中不存在的标签会自动创建,多个标签用英文竖线|分隔description支持 HTML 富文本格式
CountStories
接口描述
计算符合查询条件的需求数量并返回。
状态查询注意事项 按状态查询时,建议使用v_status参数直接传中文状态名(如v_status=规划中),同时设置with_v_status=1以便返回中文状态。因为需求状态的英文 Key 是每个项目单独配置的,使用中文名更直观、不易出错。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/stories/count
支持格式: JSON/XML(默认 JSON)
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询 |
| name | 否 | string | 标题 | 支持模糊匹配 |
| priority | 否 | string | 优先级。推荐使用 priority_label | |
| priority_label | 否 | string | 优先级(推荐) | |
| business_value | 否 | integer | 业务价值 | |
| status | 否 | string | 状态 | 支持枚举查询 |
| v_status | 否 | string | 状态(支持中文状态名) | |
| with_v_status | 否 | string | 值=1可以返回中文状态 | |
| label | 否 | string | 标签查询 | 支持枚举查询 |
| workitem_type_id | 否 | string | 需求类别ID | 支持枚举查询 |
| version | 否 | string | 版本 | |
| module | 否 | string | 模块 | |
| feature | 否 | string | 特性 | |
| test_focus | 否 | string | 测试重点 | |
| size | 否 | integer | 规模 | |
| tech_risk | 否 | string | 技术风险 | |
| owner | 否 | string | 处理人 | 支持模糊匹配 |
| cc | 否 | string | 抄送人 | 支持模糊匹配 |
| creator | 否 | string | 创建人 | 支持多人员查询 |
| developer | 否 | string | 开发人员 | |
| begin | 否 | date | 预计开始 | 支持时间查询 |
| due | 否 | date | 预计结束 | 支持时间查询 |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | 支持时间查询 |
| completed | 否 | datetime | 完成时间 | 支持时间查询 |
| iteration_id | 否 | string | 迭代ID | 支持不等于查询或枚举查询 |
| effort | 否 | string | 预估工时 | |
| effort_completed | 否 | string | 完成工时 | |
| remain | 否 | float | 剩余工时 | |
| exceed | 否 | float | 超出工时 | |
| category_id | 否 | integer | 需求分类 | 支持枚举查询 |
| release_id | 否 | integer | 发布计划 | |
| source | 否 | string | 需求来源 | |
| type | 否 | string | 需求类型 | |
| ancestor_id | 否 | integer | 祖先需求,查询指定需求下所有子需求 | |
| parent_id | 否 | integer | 父需求 | |
| children_id | 否 | string | 子需求 | 为空查询传:丨 |
| description | 否 | string | 详细描述 | 支持模糊匹配 |
| custom_field_* | 否 | string/integer | 自定义字段参数 | 支持枚举查询 |
| custom_plan_field_* | 否 | string/integer | 自定义计划应用参数 | |
| include_sub_category | 否 | string | 是否包含子分类 | 取值 0或1,默认0 |
| include_sub_iteration | 否 | string | 是否包含子迭代 | 取值 0或1,默认0 |
| include_leaf_stories | 否 | string | 是否包含子需求 | 取值 0或1,默认0 |
| limit | 否 | integer | 返回数量限制,默认30 | |
| page | 否 | integer | 页码,默认1 | |
| order | 否 | string | 排序规则,如 created%20desc | |
| fields | 否 | string | 返回字段,逗号分隔 |
请求示例
# 获取项目下需求的数量
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/stories/count?workspace_id=$TAPD_WORKSPACE_ID'
# 获取项目下优先级为 High 的需求数量
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/stories/count?workspace_id=$TAPD_WORKSPACE_ID&priority=4'返回示例
{
"status": 1,
"data": {
"count": 7
},
"info": "success"
}GetRelatedBugs
接口描述
返回符合查询条件的所有需求关联的缺陷ID。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/stories/get_related_bugs
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回所有关系
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| story_id | 是 | integer | 需求ID | 支持多ID查询 |
请求示例
# 获取某条需求关联的所有缺陷
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/stories/get_related_bugs?workspace_id=$TAPD_WORKSPACE_ID&story_id=需求ID"返回示例
{
"status": 1,
"data": [
{
"workspace_id": 10104801,
"story_id": "1010104801866181263",
"bug_id": "1010104801083691309"
},
{
"workspace_id": 10104801,
"story_id": "1010104801866181263",
"bug_id": "1010104801085894269"
}
],
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| workspace_id | 项目ID |
| story_id | 需求ID |
| bug_id | 缺陷ID |
GetStoryFieldsInfo
接口描述
获取需求所有字段及候选值。返回符合查询条件的所有需求字段及候选值。部分字段为静态候选值,建议参考下方"可选值说明"部分。其余动态字段(如 status、iteration_id、categories),需要通过该接口获取对应的候选值(中英文映射)。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/stories/get_fields_info
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回所有数据。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/stories/get_fields_info?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": {
"status": {
"name": "status",
"label": "状态",
"options": {
"planning": "规划中",
"developing": "实现中",
"resolved": "已实现",
"rejected": "已拒绝"
},
"html_type": "select",
"pure_options": [],
"readonly": 0
},
"priority": {
"name": "priority",
"label": "优先级",
"options": {
"紧急": "紧急",
"高": "高",
"中": "中",
"低": "低",
"锦上添花": "锦上添花"
},
"html_type": "select",
"pure_options": [],
"readonly": 0
},
"iteration_id": {
"name": "iteration_id",
"label": "迭代",
"options": {
"1010104801001662155": "fromAPI"
},
"html_type": "select",
"pure_options": [],
"readonly": 0
},
"category_id": {
"name": "category_id",
"label": "分类",
"options": {
"1010104801000037409": "abc",
"-1": "未分类"
},
"html_type": "select",
"pure_options": [],
"readonly": 0
}
},
"info": "success"
}返回格式说明
| 字段 | 说明 |
|---|---|
| name | 字段英文名 |
| label | 字段中文名称 |
| options | 候选值(英文Key → 中文值) |
| html_type | 字段类型(select、input、text、datetime、user_chooser、dateinput、float 等) |
| readonly | 是否只读(0 可编辑,1 只读) |
返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| name | 标题 |
| priority | 优先级 |
| business_value | 业务价值 |
| status | 状态 |
| version | 版本 |
| modified | 最后修改时间 |
| completed | 完成时间 |
| iteration_id | 迭代ID |
| templated_id | 模板ID |
| effort | 预估工时 |
| effort_completed | 完成工时 |
| remain | 剩余工时 |
| exceed | 超出工时 |
| category_id | 需求分类(取 -1 时为未分类) |
| release_id | 发布计划 |
| is_archived | 是否归档 |
| source | 来源 |
| type | 类型 |
| parent_id | 父需求 |
| children_id | 子需求 |
| description | 详细描述 |
| workspace_id | 项目ID |
| workitem_type_id | 需求类别 |
| confidential | 是否保密 |
| created_from | 需求创建来源(为空时代表 web 创建) |
| level | 层级 |
| bug_id | 缺陷ID(缺陷转需求时才有值) |
| owner | 处理人 |
| creator | 创建人 |
| created | 创建时间 |
| begin | 预计开始 |
| due | 预计结束 |
| cc | 抄送人 |
| developer | 开发人员 |
| module | 模块 |
| label | 标签 |
| size | 规模 |
| progress | 进度 |
| feature | 特性 |
| test_focus | 测试重点 |
| tech_risk | 技术风险 |
| has_attachment | 附件 |
| custom_field_* | 自定义字段 |
| custom_plan_field_* | 自定义计划字段 |
包含候选值的动态字段
| 字段 | 说明 |
|---|---|
| status | 状态枚举值(每个项目可单独配置,无固定映射,只能通过此接口获取) |
| iteration_id | 迭代枚举值 |
| category_id | 需求分类枚举值 |
| workitem_type_id | 需求类别枚举值 |
| release_id | 发布计划枚举值 |
| module | 模块枚举值 |
| version | 版本枚举值 |
| custom_field_* | 自定义字段枚举值 |
| custom_plan_field_* | 自定义计划字段枚举值 |
包含候选值的静态字段
| 字段 | 说明 |
|---|---|
| priority | 优先级枚举值 |
| source | 需求来源枚举值 |
| type | 需求类型枚举值 |
特殊说明
- 状态 (status):支持每个项目单独配置,没有固定的中英文映射,只能通过此接口获取。
- 优先级 (priority):为了兼容自定义优先级,请使用
priority_label字段。 - 需求分类 (category_id):取值
-1时表示"未分类"。
ListStories
接口描述
- 批量查询所有符合条件的需求(Story)列表,分页显示,默认一页30条。
- 注意:支持通过ID查询单个需求信息,结果以列表形式返回。
状态查询注意事项 : 按状态查询时,建议使用v_status参数直接传中文状态名(如v_status=规划中),同时设置with_v_status=1以便返回中文状态。因为需求状态的英文 Key 是每个项目单独配置的,使用中文名更直观、不易出错。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/stories
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回30条,可通过 limit 参数设置,最大200。也可传 page 参数翻页。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询 |
| name | 否 | string | 标题 | 支持模糊匹配 |
| priority | 否 | string | 优先级(旧字段,已废弃,请用 priority_label) | |
| priority_label | 否 | string | 优先级(推荐),所见即所得,直接传 High/Middle/Low 等文本值,无需数字映射 | |
| business_value | 否 | integer | 业务价值 | |
| status | 否 | string | 状态 | 支持枚举查询 |
| v_status | 否 | string | 状态(支持中文状态名) | |
| with_v_status | 否 | string | 值=1可以返回中文状态 | |
| label | 否 | string | 标签查询 | 支持枚举查询 |
| workitem_type_id | 否 | string | 需求类别ID | 支持枚举查询 |
| version | 否 | string | 版本 | |
| module | 否 | string | 模块 | |
| feature | 否 | string | 特性 | |
| test_focus | 否 | string | 测试重点 | |
| size | 否 | integer | 规模 | |
| tech_risk | 否 | string | 技术风险 | |
| owner | 否 | string | 处理人 | 支持模糊匹配 |
| cc | 否 | string | 抄送人 | 支持模糊匹配 |
| creator | 否 | string | 创建人 | 支持多人员查询 |
| developer | 否 | string | 开发人员 | |
| begin | 否 | date | 预计开始 | 支持时间查询 |
| due | 否 | date | 预计结束 | 支持时间查询 |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | 支持时间查询 |
| completed | 否 | datetime | 完成时间 | 支持时间查询 |
| iteration_id | 否 | string | 迭代ID | 支持不等于查询或枚举查询 |
| include_sub_iteration | 否 | string | 是否包含子迭代 | 取值 0或1,默认0 |
| effort | 否 | string | 预估工时 | |
| effort_completed | 否 | string | 完成工时 | |
| remain | 否 | float | 剩余工时 | |
| exceed | 否 | float | 超出工时 | |
| category_id | 否 | integer | 需求分类 | 支持枚举查询 |
| include_sub_category | 否 | string | 是否包含子分类 | 取值 0或1,默认0 |
| release_id | 否 | integer | 发布计划 | |
| source | 否 | string | 需求来源 | |
| type | 否 | string | 需求类型 | |
| ancestor_id | 否 | integer | 祖先需求,查询指定需求下所有子需求 | |
| parent_id | 否 | integer | 父需求 | |
| children_id | 否 | string | 子需求 | 为空查询传:丨 |
| include_leaf_stories | 否 | string | 是否包含子需求 | 取值 0或1,默认0 |
| description | 否 | string | 详细描述 | 支持模糊匹配 |
| custom_field_* | 否 | string/integer | 自定义字段参数 | 支持枚举查询 |
| custom_plan_field_* | 否 | string/integer | 自定义计划应用参数 | |
| limit | 否 | integer | 返回数量限制,默认30,最大200 | |
| page | 否 | integer | 页码,默认1 | |
| order | 否 | string | 排序规则,如 created%20desc | |
| fields | 否 | string | 返回字段,逗号分隔 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/stories?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": [
{
"Story": {
"id": "1010104801124922063",
"workitem_type_id": "1010104801000022091",
"name": "story_created_by_api",
"description": "<div>富文本HTML内容</div>",
"workspace_id": "10104801",
"creator": "v_xuanfang",
"created": "2025-06-16 14:42:59",
"modified": "2025-06-16 16:46:51",
"status": "planning",
"step": "",
"owner": "",
"cc": "",
"begin": null,
"due": null,
"size": null,
"priority": "",
"developer": "",
"iteration_id": "0",
"test_focus": "",
"type": "",
"source": "",
"module": "",
"version": "",
"completed": null,
"category_id": "-1",
"path": "1010104801124922063:",
"parent_id": "0",
"children_id": "|",
"ancestor_id": "1010104801124922063",
"level": "0",
"business_value": "5",
"effort": null,
"effort_completed": "0",
"exceed": "0",
"remain": "0",
"release_id": "0",
"bug_id": null,
"templated_id": null,
"created_from": "api",
"feature": "",
"label": "",
"progress": "0",
"is_archived": "0",
"tech_risk": "2",
"flows": null,
"custom_field_one": "",
"custom_field_two": "",
"custom_field_three": "1",
"custom_field_four": "",
"custom_field_five": ""
}
}
],
"info": "success"
}UpdateStory
接口描述
更新需求,返回需求更新后的数据。每次只允许更新一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/stories
支持格式: JSON/XML(默认 JSON)
请求数限制: 每次只允许更新一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| id | 是 | integer | 需求ID |
| workspace_id | 是 | integer | 项目ID |
| name | 否 | string | 标题 |
| priority_label | 否 | string | 优先级(推荐),如 High / Middle / Low 或中文值 |
| priority | 否 | string | 优先级(已废弃,请用 priority_label) |
| business_value | 否 | integer | 业务价值 |
| status | 否 | string | 状态(使用并行工作流时,按状态重置更新节点) |
| v_status | 否 | string | 状态(支持传入中文状态名称) |
| version | 否 | string | 版本 |
| module | 否 | string | 模块 |
| test_focus | 否 | string | 测试重点 |
| size | 否 | integer | 规模 |
| owner | 否 | string | 处理人 |
| current_user | 否 | string | 变更人 |
| cc | 否 | string | 抄送人 |
| developer | 否 | string | 开发人员 |
| begin | 否 | date | 预计开始(格式:YYYY-MM-DD) |
| due | 否 | date | 预计结束(格式:YYYY-MM-DD) |
| iteration_id | 否 | string | 迭代ID |
| effort | 否 | string | 预估工时 |
| effort_completed | 否 | string | 完成工时 |
| remain | 否 | float | 剩余工时 |
| exceed | 否 | float | 超出工时 |
| category_id | 否 | integer | 需求分类 |
| release_id | 否 | integer | 发布计划 |
| source | 否 | string | 来源 |
| type | 否 | string | 类型 |
| description | 否 | string | 详细描述(支持 HTML) |
| is_auto_close_task | 否 | integer | 需求流转到结束状态时是否自动关闭关联任务,传 1 自动关闭,默认 0 |
| label | 否 | string | 标签,多个用英文竖线分隔,不存在时自动创建 |
| custom_field_* | 否 | string/integer | 自定义字段,具体字段名通过「获取需求自定义字段配置」接口获取 |
| custom_plan_field_* | 否 | string/integer | 自定义计划应用参数 |
| cus_{自定义字段别名} | 否 | string | 自定义字段(后台自动转义为 custom_field_*) |
请求示例
# 更新需求优先级和处理人
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/stories" \
-d '{
"id": "需求ID",
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"priority_label": "High",
"owner": "username"
}'
# 更新需求状态和描述
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/stories" \
-d '{
"id": "需求ID",
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"status": "in_progress",
"description": "<div>更新后的描述</div>"
}'返回示例
{
"status": 1,
"data": {
"Story": {
"id": "1010104801125341253",
"name": "需求标题",
"workspace_id": "10104801",
"status": "planning",
"owner": "anyechen;",
"priority": "高",
"modified": "2025-07-08 14:51:25"
}
},
"info": "success"
}注意事项
id和workspace_id为必传字段,其余字段按需传入,未传字段不会被修改priority字段已废弃,请统一使用priority_labelstatus与v_status二选一,v_status支持中文状态名- 需求流转到结束状态时,可通过
is_auto_close_task=1自动关闭关联任务 label中不存在的标签会自动创建,多个标签用英文竖线|分隔
AddTask
接口描述
在项目下创建一条任务(Task),一次只能插入一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/tasks
支持格式: JSON/XML(默认 JSON)
请求数限制: 一次插入一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| name | 是 | string | 任务标题 |
| description | 否 | string | 详细描述(支持 HTML) |
| creator | 否 | string | 创建人 |
| owner | 否 | string | 处理人 |
| cc | 否 | string | 抄送人 |
| begin | 否 | date | 预计开始(格式:YYYY-MM-DD) |
| due | 否 | date | 预计结束(格式:YYYY-MM-DD) |
| story_id | 否 | integer | 关联需求ID |
| iteration_id | 否 | integer | 所属迭代ID |
| priority_label | 否 | string | 优先级(推荐),如 High / Middle / Low / Nice To Have |
| priority | 否 | string | 优先级(已废弃,请用 priority_label) |
| effort | 否 | string | 预估工时 |
| label | 否 | string | 标签,多个用英文竖线分隔,不存在时自动创建 |
| custom_field_* | 否 | string/integer | 自定义字段,具体字段名通过「获取任务自定义字段配置」接口获取 |
| cus_{自定义字段别名} | 否 | string | 自定义字段(后台自动转义为 custom_field_*) |
常用字段候选值
status(状态)
| 取值 | 说明 |
|---|---|
| open | 未开始 |
| progressing | 进行中 |
| done | 已完成 |
请求示例
# 创建最简任务
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tasks" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"name": "任务标题"
}'
# 创建带完整信息的任务
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tasks" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"name": "任务标题",
"owner": "username",
"priority_label": "High",
"story_id": "关联需求ID",
"iteration_id": "迭代ID",
"begin": "2026-03-10",
"due": "2026-03-31",
"effort": "8",
"description": "<div>任务详细描述</div>"
}'返回示例
{
"status": 1,
"data": {
"Task": {
"id": "1010158231500600411",
"name": "任务标题",
"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,
"story_id": "0",
"iteration_id": "0",
"priority": "",
"progress": "0",
"effort": "0",
"label": "",
"created_from": "api"
}
},
"info": "success"
}注意事项
priority字段已废弃,请统一使用priority_labellabel中不存在的标签会自动创建,多个标签用英文竖线|分隔description支持 HTML 富文本格式status动态可选值需通过「获取任务所有字段及候选值」接口获取
CountTasks
接口描述
计算符合查询条件的任务数量并返回。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/tasks/count
支持格式: JSON/XML(默认 JSON)
请求数限制: 只返回任务数量
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询、模糊匹配 |
| name | 否 | string | 任务标题 | 支持模糊匹配 |
| description | 否 | string | 任务详细描述 | |
| creator | 否 | string | 创建人 | 支持模糊匹配 |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | |
| status | 否 | string | 状态 | 支持枚举查询 |
| label | 否 | string | 标签查询 | 支持枚举查询 |
| owner | 否 | string | 任务当前处理人 | 支持模糊匹配 |
| cc | 否 | string | 抄送人 | |
| begin | 否 | date | 预计开始 | 支持时间查询 |
| due | 否 | date | 预计结束 | 支持时间查询 |
| story_id | 否 | integer | 关联需求的ID | 支持多ID查询 |
| iteration_id | 否 | integer | 所属迭代的ID | |
| priority | 否 | string | 优先级。推荐使用 priority_label | |
| priority_label | 否 | string | 优先级(推荐) | |
| progress | 否 | integer | 进度 | |
| completed | 否 | datetime | 完成时间 | 支持时间查询 |
| effort_completed | 否 | string | 完成工时 | |
| exceed | 否 | float | 超出工时 | |
| remain | 否 | float | 剩余工时 | |
| effort | 否 | string | 预估工时 | |
| custom_field_* | 否 | string/integer | 自定义字段参数,具体字段名通过「获取任务自定义字段配置」接口获取 | 支持枚举查询 |
任务状态(status)字段说明
| 取值 | 字面值 |
|---|---|
| open | 未开始 |
| progressing | 进行中 |
| done | 已完成 |
任务优先级(priority)字段说明
推荐使用 priority_label 字段。以下取值将不再使用。
| 取值 | 字面值 |
|---|---|
| 4 | High |
| 3 | Middle |
| 2 | Low |
| 1 | Nice To Have |
请求示例
# 获取项目下的任务数量
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/tasks/count?workspace_id=$TAPD_WORKSPACE_ID"
# 获取指定处理人、进行中的任务数量
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/tasks/count?workspace_id=$TAPD_WORKSPACE_ID&owner=username&status=progressing"返回示例
{
"status": 1,
"data": {
"count": 1
},
"info": "success"
}ListTasks
接口描述
返回符合查询条件的所有任务(分页显示,默认一页30条)。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/tasks
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回30条,可通过 limit 参数设置,最大200。也可传 page 参数翻页。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询 |
| name | 否 | string | 任务标题 | 支持模糊匹配 |
| description | 否 | string | 任务详细描述 | |
| creator | 否 | string | 创建人 | 支持多人员查询 |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | 支持时间查询 |
| status | 否 | string | 状态 | 支持枚举查询 |
| label | 否 | string | 标签查询 | 支持枚举查询 |
| owner | 否 | string | 任务当前处理人 | 支持模糊匹配 |
| cc | 否 | string | 抄送人 | |
| begin | 否 | date | 预计开始 | 支持时间查询 |
| due | 否 | date | 预计结束 | 支持时间查询 |
| story_id | 否 | integer | 关联需求的ID | 支持多ID查询 |
| iteration_id | 否 | integer | 所属迭代的ID | 支持枚举查询 |
| priority | 否 | string | 优先级。推荐使用 priority_label | |
| priority_label | 否 | string | 优先级(推荐) | |
| progress | 否 | integer | 进度 | |
| completed | 否 | datetime | 完成时间 | 支持时间查询 |
| effort_completed | 否 | string | 完成工时 | |
| exceed | 否 | float | 超出工时 | |
| remain | 否 | float | 剩余工时 | |
| effort | 否 | string | 预估工时 | |
| custom_field_* | 否 | string/integer | 自定义字段参数 | 支持枚举查询 |
| limit | 否 | integer | 返回数量限制,默认30,最大200 | |
| page | 否 | integer | 页码,默认1 | |
| order | 否 | string | 排序规则,如 created%20desc | |
| fields | 否 | string | 返回字段,逗号分隔 |
任务状态(status)字段说明
| 取值 | 字面值 |
|---|---|
| open | 未开始 |
| progressing | 进行中 |
| done | 已完成 |
任务优先级(priority)字段说明
推荐使用 priority_label 字段。以下取值将不再使用。
| 取值 | 字面值 |
|---|---|
| 4 | High |
| 3 | Middle |
| 2 | Low |
| 1 | Nice To Have |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/tasks?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": [
{
"Task": {
"id": "1020358627854792559",
"name": "测试2",
"description": " ",
"workspace_id": "20358627",
"creator": "v_xinyucao",
"created": "2021-06-02 10:36:19",
"modified": "2022-07-05 15:54:10",
"status": "open",
"owner": "",
"cc": "",
"begin": null,
"due": null,
"story_id": "0",
"iteration_id": "0",
"priority": "",
"progress": "0",
"completed": null,
"effort_completed": "0",
"exceed": "0",
"remain": "0",
"effort": "0",
"has_attachment": "0",
"release_id": "1020358627100003283",
"label": null,
"custom_field_one": null
}
}
],
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| name | 任务标题 |
| description | 任务详细描述 |
| workspace_id | 项目ID |
| creator | 创建人 |
| created | 创建时间 |
| modified | 最后修改时间 |
| status | 状态 |
| owner | 任务当前处理人 |
| cc | 抄送人 |
| begin | 预计开始 |
| due | 预计结束 |
| release_id | 发布计划ID |
| story_id | 关联需求的ID |
| iteration_id | 所属迭代的ID |
| priority | 优先级 |
| priority_label | 优先级 |
| progress | 进度 |
| completed | 完成时间 |
| effort_completed | 完成工时 |
| exceed | 超出工时 |
| remain | 剩余工时 |
| effort | 预估工时 |
UpdateTask
接口描述
更新任务,返回任务更新后的数据。每次只允许更新一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/tasks
支持格式: JSON/XML(默认 JSON)
请求数限制: 每次只允许更新一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| id | 是 | integer | 任务ID |
| workspace_id | 是 | integer | 项目ID |
| name | 否 | string | 任务标题 |
| description | 否 | string | 详细描述(支持 HTML) |
| creator | 否 | string | 创建人 |
| status | 否 | string | 状态:open / progressing / done |
| owner | 否 | string | 处理人 |
| current_user | 否 | string | 操作人 |
| cc | 否 | string | 抄送人 |
| begin | 否 | date | 预计开始(格式:YYYY-MM-DD) |
| due | 否 | date | 预计结束(格式:YYYY-MM-DD) |
| story_id | 否 | integer | 关联需求ID |
| iteration_id | 否 | integer | 所属迭代ID |
| priority_label | 否 | string | 优先级(推荐),如 High / Middle / Low / Nice To Have |
| priority | 否 | string | 优先级(已废弃,请用 priority_label) |
| effort | 否 | string | 预估工时 |
| auto_complete_effort | 否 | integer | 传 1 时,状态流转到 done 则自动补齐工时 |
| label | 否 | string | 标签,多个用英文竖线分隔,不存在时自动创建 |
| custom_field_* | 否 | string/integer | 自定义字段,具体字段名通过「获取任务自定义字段配置」接口获取 |
| cus_{自定义字段别名} | 否 | string | 自定义字段(后台自动转义为 custom_field_*) |
常用字段候选值
status(状态)
| 取值 | 说明 |
|---|---|
| open | 未开始 |
| progressing | 进行中 |
| done | 已完成 |
请求示例
# 更新任务状态为已完成
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tasks" \
-d '{
"id": "任务ID",
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"status": "done",
"current_user": "username"
}'
# 更新任务处理人和预计时间
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tasks" \
-d '{
"id": "任务ID",
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"owner": "username",
"begin": "2026-03-10",
"due": "2026-03-31",
"priority_label": "High"
}'返回示例
{
"status": 1,
"data": {
"Task": {
"id": "1010158231500600385",
"name": "检查数据库",
"workspace_id": "10158231",
"status": "done",
"owner": null,
"priority": "",
"progress": "0",
"completed": "2019-06-27 11:05:26",
"effort": "0",
"modified": "2019-06-27 11:05:27"
}
},
"info": "success"
}注意事项
id和workspace_id为必传字段,其余字段按需传入,未传字段不会被修改priority字段已废弃,请统一使用priority_labelauto_complete_effort=1配合status=done使用,可自动将剩余工时补齐为完成工时label中不存在的标签会自动创建,多个标签用英文竖线|分隔
AddTimesheet
接口描述
新建花费工时,返回新建花费工时的数据。一次插入一条数据。注意同一 entity_type、entity_id、spentdate、owner 只能有一条工时记录。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/timesheets
支持格式: JSON/XML(默认 JSON)
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| entity_type | 是 | string | 对象类型,如 story、task、bug 等 |
| entity_id | 是 | integer | 对象ID |
| timespent | 是 | string | 花费工时 |
| owner | 是 | string | 花费创建人 |
| timeremain | 否 | string | 剩余工时 |
| spentdate | 否 | date | 花费日期 |
| memo | 否 | string | 花费描述 |
请求示例
curl -s -X POST -H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/timesheets" \
-d '{"workspace_id":"'"${TAPD_WORKSPACE_ID}"'","entity_type":"story","entity_id":"1010158231500709717","owner":"anyechen","timespent":"2","spentdate":"2020-05-05"}'返回示例
{
"status": 1,
"data": {
"Timesheet": {
"id": "1010158231001169003",
"entity_type": "story",
"entity_id": "1010158231500709717",
"timespent": "2",
"spentdate": "2020-05-05",
"owner": "anyechen",
"created": "2020-05-06 22:08:35",
"workspace_id": "10158231",
"memo": null
}
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| entity_type | 对象类型,如 story、task、bug 等 |
| entity_id | 对象ID |
| timespent | 花费工时 |
| timeremain | 剩余工时 |
| spentdate | 花费日期 |
| owner | 花费创建人 |
| created | 创建时间 |
| workspace_id | 项目ID |
| memo | 花费描述 |
CountTimesheets
接口描述
计算符合查询条件的花费工时数量并返回。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/timesheets/count
支持格式: JSON/XML(默认 JSON)
请求数限制: 只返回花费工时数量。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询 |
| entity_type | 否 | string | 对象类型,如 story、task、bug 等 | |
| entity_id | 否 | integer | 对象ID | |
| timespent | 否 | string | 花费工时 | |
| spentdate | 否 | date | 花费日期 | 支持时间查询 |
| owner | 否 | string | 花费创建人 | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| memo | 否 | string | 花费描述 | |
| is_delete | 否 | integer | 是否已删除。默认取 0,不返回已删除记录。取 1 返回已删除记录 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/timesheets/count?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": {
"count": 14
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| count | 符合条件的花费工时数量 |
ListTimesheets
接口描述
返回符合查询条件的所有花费工时(分页显示,默认一页30条)。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/timesheets
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回30条,可通过 limit 参数设置,最大200。也可传 page 参数翻页。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | 支持多ID查询 |
| entity_type | 否 | string | 对象类型,如 story、task、bug 等 | |
| entity_id | 否 | integer | 对象ID | |
| timespent | 否 | string | 花费工时 | |
| spentdate | 否 | date | 花费日期 | 支持时间查询 |
| modified | 否 | date | 最后修改时间 | 支持时间查询 |
| owner | 否 | string | 花费创建人 | |
| include_parent_story_timesheet | 否 | integer | 值=0 不返回父需求的花费 | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| memo | 否 | string | 花费描述 | |
| is_delete | 否 | integer | 是否已删除。默认取 0,不返回已删除记录。取 1 返回已删除记录 | |
| limit | 否 | integer | 返回数量限制,默认30,最大200 | |
| page | 否 | integer | 页码,默认1 | |
| order | 否 | string | 排序规则,如 created%20desc | |
| fields | 否 | string | 返回字段,逗号分隔 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/timesheets?workspace_id=$TAPD_WORKSPACE_ID'按日期查询
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/timesheets?workspace_id=$TAPD_WORKSPACE_ID&spentdate=2020-05-05'按对象类型和对象ID查询
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/timesheets?workspace_id=$TAPD_WORKSPACE_ID&entity_type=story&entity_id=1010158231500709717'按花费创建人查询
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/timesheets?workspace_id=$TAPD_WORKSPACE_ID&owner=anyechen&limit=3'返回示例
{
"status": 1,
"data": [
{
"Timesheet": {
"id": "1010158231001168997",
"entity_type": "story",
"entity_id": "1010158231500709717",
"timespent": "8",
"spentdate": "2020-05-05",
"owner": "anyechen",
"created": "2020-05-06 19:32:35",
"workspace_id": "10158231",
"memo": "hey"
}
}
],
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| entity_type | 对象类型,如 story、task、bug 等 |
| entity_id | 对象ID |
| timespent | 花费工时 |
| spentdate | 花费日期 |
| owner | 花费创建人 |
| created | 创建时间 |
| workspace_id | 项目ID |
| modified | 最后修改时间 |
| memo | 花费描述 |
| is_delete | 是否已删除 |
UpdateTimesheet
接口描述
更新花费工时,返回花费工时更新后的数据。每次只允许更新一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/timesheets
支持格式: JSON/XML(默认 JSON)
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| id | 是 | integer | ID |
| workspace_id | 是 | integer | 项目ID |
| timespent | 否 | string | 花费工时 |
| timeremain | 否 | string | 剩余工时 |
| memo | 否 | string | 花费描述 |
请求示例
curl -s -X POST -H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/timesheets" \
-d '{"id":"1010158231001169003","workspace_id":"'"${TAPD_WORKSPACE_ID}"'","timespent":"3"}'返回示例
{
"status": 1,
"data": {
"Timesheet": {
"id": "1010158231001169003",
"entity_type": "story",
"entity_id": "1010158231500709717",
"timespent": "3",
"spentdate": "2020-05-05",
"owner": "anyechen",
"created": "2020-05-06 22:08:35",
"workspace_id": "10158231",
"memo": "hey"
}
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| entity_type | 对象类型,如 story、task、bug 等 |
| entity_id | 对象ID |
| timespent | 花费工时 |
| timeremain | 剩余工时 |
| spentdate | 花费日期 |
| owner | 花费创建人 |
| created | 创建时间 |
| workspace_id | 项目ID |
| memo | 花费描述 |
GetUserInfo
接口描述
可用于获取当前用户信息,便于后续需要使用用户信息时,直接调用此接口获取。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/users/info
支持格式: JSON/XML(默认 JSON)
请求参数
无额外请求参数,使用 Token 自动获取当前用户信息。
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/users/info'返回示例
{
"status": 1,
"data": {
"id": "6081",
"nick": "robertyang",
"name": "杨晓俊",
"avatar": "http://tiger.oa.com/0/users/avatar/6081/jpg/0/large",
"enabled": "1",
"status_id": "1",
"status_name": "在职"
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | 用户ID |
| nick | 英文ID(nick 和 id 都能作为用户的唯一标识) |
| name | 中文名 |
| avatar | 头像 |
| enabled | 是否有效:1-是;0-否 |
| status_id | 状态:1-在职;2-离职;3-冻结 |
| status_name | 状态名 |
ListWorkspaces
接口描述
获取当前用户有权限访问的所有工作空间(项目)列表。当 TAPD_WORKSPACE_ID 和 TAPD_WORKSPACE_IDS 均未配置时,可用此接口自动获取。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/open_user_app/workspace_list
支持格式: JSON
请求参数
无额外请求参数,使用 Token 自动获取当前用户可访问的工作空间列表。
请求示例
curl -s -H "Authorization: Bearer $TAPD_TOKEN" \
"${TAPD_API_ENDPOINT}/open_user_app/workspace_list"返回示例
{
"status": 1,
"data": [
{
"Workspace": {
"id": "20001921",
"name": "示例项目",
"pretty_name": "20001921"
}
},
{
"Workspace": {
"id": "33356006",
"name": "DevOps项目",
"pretty_name": "33356006"
}
}
],
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | 工作空间(项目)ID |
| name | 工作空间名称 |
| pretty_name | 工作空间标识 |
AddWiki
接口描述
在项目下创建一条 Wiki,一次只能插入一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/tapd_wikis
支持格式: JSON/XML(默认 JSON)
请求数限制: 一次插入一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| name | 是 | string | 标题 |
| creator | 是 | string | 创建人 |
| description | 否 | string | 富文本 |
| markdown_description | 否 | string | Markdown |
| note | 否 | string | 备注 |
| parent_wiki_id | 否 | string | 父wiki ID |
请求示例
# 创建最简 Wiki
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tapd_wikis" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"name": "Wiki 标题",
"creator": "username"
}'
# 创建带 Markdown 内容的 Wiki
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tapd_wikis" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"name": "Wiki 标题",
"creator": "username",
"markdown_description": "# 标题\n\n正文内容",
"parent_wiki_id": "父wiki ID"
}'
# 创建带富文本内容的 Wiki
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tapd_wikis" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"name": "Wiki 标题",
"creator": "username",
"description": "<div>富文本内容</div>",
"note": "备注信息"
}'返回示例
{
"status": 1,
"data": {
"Wiki": {
"id": "1210104801000043897",
"name": "test111",
"workspace_id": "10104801",
"description": "xxxxxxx",
"markdown_description": "",
"is_rich": "1",
"parent_wiki_id": "0",
"note": "",
"view_count": "0",
"created": "2020-08-26 10:15:28",
"creator": "v_xuanfang",
"modified": "2020-08-26 10:15:28",
"modifier": "v_xuanfang"
}
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| name | 标题 |
| description | 富文本 |
| markdown_description | Markdown |
| parent_wiki_id | 父wiki ID |
| author | 修改人 |
| creator | 创建人 |
| note | 备注 |
| view_count | 浏览量 |
| created | 创建时间 |
| modified | 最后修改时间 |
| modifier | 最后修改人 |
| workspace_id | 项目ID |
注意事项
name、creator、workspace_id为必填参数description(富文本)和markdown_description(Markdown)二选一即可,同时传以description为准parent_wiki_id不传或传"0"表示创建顶层 Wiki
CountWikis
接口描述
计算符合查询条件的 Wiki 数量并返回。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/tapd_wikis/count
支持格式: JSON/XML(默认 JSON)
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| name | 否 | string | 标题 | 支持模糊匹配 |
| modifier | 否 | string | 修改人 | |
| creator | 否 | string | 创建人 | |
| note | 否 | string | 备注 | |
| view_count | 否 | string | 浏览量 | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | 支持时间查询 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/tapd_wikis/count?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": {
"count": 23
},
"info": "success"
}ListWikis
接口描述
返回符合查询条件的所有 Wiki(分页显示,默认一页30条)。
请求信息
请求方法: GET
请求地址: ${TAPD_API_ENDPOINT}/tapd_wikis
支持格式: JSON/XML(默认 JSON)
请求数限制: 默认返回30条,可通过 limit 参数设置,最大200。也可传 page 参数翻页。
请求参数
| 参数名 | 必选 | 类型 | 说明 | 特殊规则 |
|---|---|---|---|---|
| workspace_id | 是 | integer | 项目ID | |
| id | 否 | integer | ID | |
| name | 否 | string | 标题 | |
| modifier | 否 | string | 修改人 | |
| creator | 否 | string | 创建人 | |
| note | 否 | string | 备注 | |
| view_count | 否 | string | 浏览量 | |
| created | 否 | datetime | 创建时间 | 支持时间查询 |
| modified | 否 | datetime | 最后修改时间 | 支持时间查询 |
| limit | 否 | integer | 返回数量限制,默认30 | |
| page | 否 | integer | 页码,默认1 | |
| order | 否 | string | 排序规则,如 created%20desc | |
| fields | 否 | string | 返回字段,逗号分隔 |
请求示例
curl -H 'Authorization: Bearer $TAPD_TOKEN' \
'${TAPD_API_ENDPOINT}/tapd_wikis?workspace_id=$TAPD_WORKSPACE_ID'返回示例
{
"status": 1,
"data": [
{
"Wiki": {
"id": "1210104801000043827",
"name": "test888",
"workspace_id": "10104801",
"description": "",
"markdown_description": "",
"is_rich": "0",
"parent_wiki_id": "0",
"note": "",
"view_count": "0",
"created": "2020-08-25 11:24:44",
"creator": "dev",
"modified": "2020-08-25 11:24:44",
"modifier": "dev"
}
}
],
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| name | 标题 |
| description | 富文本 |
| markdown_description | Markdown |
| parent_wiki_id | 父wiki ID |
| author | 修改人 |
| creator | 创建人 |
| note | 备注 |
| view_count | 浏览量 |
| created | 创建时间 |
| modified | 最后修改时间 |
| modifier | 最后修改人 |
| workspace_id | 项目ID |
SearchWiki
接口描述
TAPD API 不支持 Wiki 全文搜索,通过 scripts/search_wiki.py 实现本地搜索。
原理:先将全部 Wiki 同步到本地缓存,再用关键词在本地搜索,返回匹配的内容片段和链接。
默认拉取最新的 5000 篇(按最后修改时间倒序),可通过环境变量 PLUGIN_TAPD_WIKI_MAX 调整。
1. 同步 Wiki(首次使用或需要更新时)
python3 ~/.codebuddy/skills/tapd-openapi/scripts/search_wiki.py sync
# 自定义最大拉取数量
PLUGIN_TAPD_WIKI_MAX=500 python3 ~/.codebuddy/skills/tapd-openapi/scripts/search_wiki.py syncWiki 缓存保存在 ~/.tapd-wiki-cache/{workspace_id}/ 目录,每篇 Wiki 一个 .md 文件。
2. 搜索 Wiki
# 全文搜索(标题 + 正文)
python3 ~/.codebuddy/skills/tapd-openapi/scripts/search_wiki.py search 关键词
# 多关键词(取交集)
python3 ~/.codebuddy/skills/tapd-openapi/scripts/search_wiki.py search 关键词1 关键词2
# 仅搜索标题
python3 ~/.codebuddy/skills/tapd-openapi/scripts/search_wiki.py search 关键词 --title-only3. 进一步搜索(可选)
同步完成后,也可以直接用 grep 等工具搜索缓存文件:
grep -rl '关键词' ~/.tapd-wiki-cache/
cat ~/.tapd-wiki-cache/{workspace_id}/{wiki_id}.md返回示例
找到 3 篇匹配的 Wiki(关键词: 部署)
### 1. 生产环境部署指南
- 链接: https://www.tapd.cn/31372104/markdown_wikis/show/#1131372104001000001
- 最后修改: 2025-03-10 14:30:00 by dev
- 匹配片段:
> 前置准备工作完成后即可开始操作。 本文档介绍生产环境的**部署**流程,包括构建、发布和回滚操作。 具体步骤如下。返回字段说明
| 字段 | 说明 |
|---|---|
| name | Wiki 标题 |
| url | Wiki 链接,格式 https://www.tapd.cn/{workspace_id}/markdown_wikis/show/#{wiki_id} |
| modified | 最后修改时间 |
| modifier | 最后修改人 |
| snippets | 匹配的内容片段(关键词所在句子及前后各一句,关键词 加粗 显示) |
UpdateWiki
接口描述
更新一条 Wiki,返回更新后的数据。每次只允许更新一条数据。
请求信息
请求方法: POST
请求地址: ${TAPD_API_ENDPOINT}/tapd_wikis
支持格式: JSON/XML(默认 JSON)
请求数限制: 每次只允许更新一条数据
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| workspace_id | 是 | integer | 项目ID |
| id | 是 | integer | Wiki ID |
| name | 否 | string | 标题 |
| description | 否 | string | 富文本 |
| markdown_description | 否 | string | Markdown |
| note | 否 | string | 备注 |
| parent_wiki_id | 否 | string | 父wiki ID |
请求示例
# 更新 Wiki 标题和富文本内容
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tapd_wikis" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"id": "Wiki ID",
"name": "新标题",
"description": "<div>更新后的富文本内容</div>"
}'
# 更新 Wiki Markdown 内容
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tapd_wikis" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"id": "Wiki ID",
"markdown_description": "# 更新后的标题\n\n更新后的正文"
}'
# 移动 Wiki 到其他父节点下
curl -s -X POST \
-H "Authorization: Bearer $TAPD_TOKEN" \
-H "Content-Type: application/json" \
"${TAPD_API_ENDPOINT}/tapd_wikis" \
-d '{
"workspace_id": "'"$TAPD_WORKSPACE_ID"'",
"id": "Wiki ID",
"parent_wiki_id": "目标父wiki ID"
}'返回示例
{
"status": 1,
"data": {
"Wiki": {
"id": "1210104801000043897",
"name": "test111",
"workspace_id": "10104801",
"description": "内容被更新",
"markdown_description": "",
"is_rich": "1",
"parent_wiki_id": "0",
"note": "",
"view_count": "1",
"created": "2020-08-26 10:15:28",
"creator": "v_xuanfang",
"modified": "2020-08-26 10:30:11",
"modifier": "dev"
}
},
"info": "success"
}返回字段说明
| 字段 | 说明 |
|---|---|
| id | ID |
| name | 标题 |
| description | 富文本 |
| markdown_description | Markdown |
| parent_wiki_id | 父wiki ID |
| author | 修改人 |
| creator | 创建人 |
| note | 备注 |
| view_count | 浏览量 |
| created | 创建时间 |
| modified | 最后修改时间 |
| modifier | 最后修改人 |
| workspace_id | 项目ID |
注意事项
workspace_id和id为必填参数- 只需传入要更新的字段,未传入的字段保持不变
description(富文本)和markdown_description(Markdown)二选一即可- 可通过修改
parent_wiki_id将 Wiki 移动到其他父节点下
#!/usr/bin/env python3
"""
TAPD Wiki 同步与搜索工具
用法:
python3 search_wiki.py sync # 下载全部 Wiki 到本地缓存
python3 search_wiki.py search <关键词> # 搜索 Wiki 内容(支持多个关键词,空格分隔取交集)
python3 search_wiki.py search <关键词> --title-only # 仅搜索标题
"""
import json
import os
import re
import sys
import time
import urllib.request
import urllib.error
import urllib.parse
# ============================================================
# 配置
# ============================================================
API_ENDPOINT = os.environ.get("TAPD_API_ENDPOINT", "")
TOKEN = os.environ.get("TAPD_TOKEN", "")
WORKSPACE_IDS_STR = os.environ.get("TAPD_WORKSPACE_IDS", "") or os.environ.get("TAPD_WORKSPACE_ID", "")
TAPD_SITE_URL = os.environ.get("TAPD_SITE_URL", "") or API_ENDPOINT.replace("://api.", "://", 1)
CACHE_DIR = os.path.join(os.environ.get("HOME", "/tmp"), ".tapd-wiki-cache")
PAGE_SIZE = 200 # ListWikis 最大每页 200
MAX_WIKIS = 5000
CONTEXT_CHARS = 150 # 搜索结果上下文字符数
# ============================================================
# API 请求
# ============================================================
def api_get(path, params=None):
"""发送 GET 请求到 TAPD API,返回 JSON 数据"""
url = f"{API_ENDPOINT}/{path}"
if params:
url += "?" + urllib.parse.urlencode(params)
req = urllib.request.Request(url, headers={"Authorization": f"Bearer {TOKEN}"})
try:
with urllib.request.urlopen(req, timeout=30) as resp:
data = json.loads(resp.read().decode())
if data.get("status") != 1:
print(f" API 错误: {data.get('info', '未知')}", file=sys.stderr)
return None
return data.get("data")
except urllib.error.HTTPError as e:
print(f" HTTP {e.code}: {e.reason}", file=sys.stderr)
return None
except Exception as e:
print(f" 请求失败: {e}", file=sys.stderr)
return None
# ============================================================
# Wiki 同步
# ============================================================
def get_workspace_ids():
return [ws.strip() for ws in WORKSPACE_IDS_STR.split(",") if ws.strip()]
def fetch_wiki_count(workspace_id):
data = api_get("tapd_wikis/count", {"workspace_id": workspace_id})
if data and "count" in data:
return int(data["count"])
return 0
def fetch_wikis_page(workspace_id, page):
data = api_get("tapd_wikis", {
"workspace_id": workspace_id,
"limit": PAGE_SIZE,
"page": page,
"order": "modified desc",
"fields": "id,name,workspace_id,description,markdown_description,parent_wiki_id,creator,modifier,created,modified",
})
if not data:
return []
return [item.get("Wiki", item) for item in data if isinstance(item, dict)]
def wiki_url(workspace_id, wiki_id):
return f"{TAPD_SITE_URL}/{workspace_id}/markdown_wikis/show/#{wiki_id}"
def save_wiki(workspace_id, wiki):
ws_dir = os.path.join(CACHE_DIR, str(workspace_id))
os.makedirs(ws_dir, exist_ok=True)
wiki_id = wiki.get("id", "unknown")
name = wiki.get("name", "")
content = wiki.get("markdown_description") or wiki.get("description") or ""
url = wiki_url(workspace_id, wiki_id)
header = (
f"---\n"
f"id: {wiki_id}\n"
f"name: {name}\n"
f"workspace_id: {workspace_id}\n"
f"parent_wiki_id: {wiki.get('parent_wiki_id', '')}\n"
f"creator: {wiki.get('creator', '')}\n"
f"modifier: {wiki.get('modifier', '')}\n"
f"created: {wiki.get('created', '')}\n"
f"modified: {wiki.get('modified', '')}\n"
f"url: {url}\n"
f"---\n\n"
)
filepath = os.path.join(ws_dir, f"{wiki_id}.md")
with open(filepath, "w", encoding="utf-8") as f:
f.write(header + content)
return filepath
def cmd_sync():
"""下载全部 Wiki 到本地缓存"""
workspace_ids = get_workspace_ids()
if not workspace_ids:
print("错误: 未配置 TAPD_WORKSPACE_IDS 或 TAPD_WORKSPACE_ID", file=sys.stderr)
sys.exit(1)
if not API_ENDPOINT:
print("错误: 未配置 TAPD_API_ENDPOINT,请设置环境变量 TAPD_API_ENDPOINT", file=sys.stderr)
sys.exit(1)
if not TOKEN:
print("错误: 未配置 TAPD_TOKEN,请设置环境变量 TAPD_TOKEN", file=sys.stderr)
sys.exit(1)
os.makedirs(CACHE_DIR, exist_ok=True)
total_saved = 0
for ws_id in workspace_ids:
count = fetch_wiki_count(ws_id)
remaining = MAX_WIKIS - total_saved
if remaining <= 0:
print(f"[workspace {ws_id}] 已达最大拉取数量 {MAX_WIKIS},跳过")
break
effective = min(count, remaining)
print(f"[workspace {ws_id}] 共 {count} 篇 Wiki,本次拉取 {effective} 篇(上限 {MAX_WIKIS})")
if count == 0:
continue
pages = (effective + PAGE_SIZE - 1) // PAGE_SIZE
ws_saved = 0
for page in range(1, pages + 1):
wikis = fetch_wikis_page(ws_id, page)
if not wikis:
break
for wiki in wikis:
save_wiki(ws_id, wiki)
ws_saved += 1
if total_saved + ws_saved >= MAX_WIKIS:
break
print(f" 已同步 {ws_saved}/{effective}")
if len(wikis) < PAGE_SIZE or total_saved + ws_saved >= MAX_WIKIS:
break
time.sleep(0.2)
total_saved += ws_saved
meta = {"synced_at": time.strftime("%Y-%m-%d %H:%M:%S"), "workspace_ids": workspace_ids, "total": total_saved}
with open(os.path.join(CACHE_DIR, "meta.json"), "w") as f:
json.dump(meta, f, ensure_ascii=False, indent=2)
print(f"\n同步完成: {total_saved} 篇 Wiki -> {CACHE_DIR}")
# ============================================================
# Wiki 搜索
# ============================================================
def parse_front_matter(text):
"""解析 YAML front matter,返回 (metadata_dict, body)"""
if not text.startswith("---\n"):
return {}, text
end = text.find("\n---\n", 4)
if end == -1:
return {}, text
header = text[4:end]
body = text[end + 5:]
meta = {}
for line in header.split("\n"):
idx = line.find(": ")
if idx > 0:
meta[line[:idx].strip()] = line[idx + 2:].strip()
return meta, body
def _split_sentences(text):
"""按中英文句末标点或换行拆分句子,保留非空句子"""
parts = re.split(r'(?<=[。!?!?\n])', text)
return [s.strip() for s in parts if s.strip()]
def extract_context(text, keyword, chars=CONTEXT_CHARS):
"""提取关键词所在句子及前后各一句,并加粗关键词"""
lower_kw = keyword.lower()
if lower_kw not in text.lower():
return None
sentences = _split_sentences(text)
if not sentences:
return None
matched_indices = set()
for i, sent in enumerate(sentences):
if lower_kw in sent.lower():
matched_indices.add(i)
if not matched_indices:
return None
indices = set()
for idx in matched_indices:
indices.update(range(max(0, idx - 1), min(len(sentences), idx + 2)))
selected = [sentences[i] for i in sorted(indices)]
snippet = " ".join(selected)
bold_pattern = re.compile(re.escape(keyword), re.IGNORECASE)
snippet = bold_pattern.sub(lambda m: f"**{m.group()}**", snippet)
return snippet
def search_wikis(keywords, title_only=False):
"""搜索本地缓存的 Wiki,返回匹配结果列表"""
if not os.path.isdir(CACHE_DIR):
print(f"缓存目录不存在,请先执行 sync: {CACHE_DIR}", file=sys.stderr)
sys.exit(1)
lower_keywords = [kw.lower() for kw in keywords]
results = []
for ws_dir_name in os.listdir(CACHE_DIR):
ws_path = os.path.join(CACHE_DIR, ws_dir_name)
if not os.path.isdir(ws_path):
continue
for fname in os.listdir(ws_path):
if not fname.endswith(".md"):
continue
filepath = os.path.join(ws_path, fname)
with open(filepath, "r", encoding="utf-8") as f:
content = f.read()
meta, body = parse_front_matter(content)
name = meta.get("name", "")
search_text = name if title_only else f"{name}\n{body}"
lower_search = search_text.lower()
if not all(kw in lower_search for kw in lower_keywords):
continue
snippets = []
for kw in keywords:
ctx = extract_context(search_text, kw)
if ctx:
snippets.append(ctx)
results.append({
"name": name,
"url": meta.get("url", ""),
"workspace_id": meta.get("workspace_id", ""),
"modifier": meta.get("modifier", ""),
"modified": meta.get("modified", ""),
"snippets": snippets,
})
results.sort(key=lambda r: r.get("modified", ""), reverse=True)
return results
def cmd_search(keywords, title_only=False):
"""搜索 Wiki 并输出结果"""
results = search_wikis(keywords, title_only)
if not results:
print(f"未找到匹配的 Wiki(关键词: {', '.join(keywords)})")
return
print(f"找到 {len(results)} 篇匹配的 Wiki(关键词: {', '.join(keywords)})\n")
for i, r in enumerate(results, 1):
print(f"### {i}. {r['name']}")
print(f"- 链接: {r['url']}")
print(f"- 最后修改: {r['modified']} by {r['modifier']}")
if r["snippets"]:
print(f"- 匹配片段:")
for s in r["snippets"]:
print(f" > {s}")
print()
# ============================================================
# 入口
# ============================================================
def main():
if len(sys.argv) < 2:
print(__doc__)
sys.exit(1)
cmd = sys.argv[1]
if cmd == "sync":
cmd_sync()
elif cmd == "search":
if len(sys.argv) < 3:
print("用法: search_wiki.py search <关键词> [--title-only]", file=sys.stderr)
sys.exit(1)
title_only = "--title-only" in sys.argv
keywords = [a for a in sys.argv[2:] if not a.startswith("--")]
cmd_search(keywords, title_only)
else:
print(f"未知命令: {cmd}", file=sys.stderr)
print(__doc__)
sys.exit(1)
if __name__ == "__main__":
main()
Related skills
FAQ
What does it need to authenticate?
A TAPD_TOKEN Bearer token plus TAPD_API_ENDPOINT and one or more workspace IDs (TAPD_WORKSPACE_IDS or TAPD_WORKSPACE_ID).
Can it search wikis?
Yes, but since the TAPD API lacks full-text wiki search, it uses a local script for searchwiki.