Environment variables (already preset)
TAPD_API_ENDPOINT- API address, ifTAPD_API_ENDPOINTis configured, then preferentially useTAPD_API_ENDPOINTthe replacement in the documentation for${TAPD_API_ENDPOINT}TAPD_WORKSPACE_IDS- Project ID list, comma-separated,takes priority overTAPD_WORKSPACE_IDTAPD_WORKSPACE_ID- Single project ID (compatible with old configuration)TAPD_TOKEN- Authentication Token (Bearer method)
Workspace handling rules
Before calling, you must first determine the actual list of workspaces to use:
# 优先取 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
- If
WS_LISThas only one ID, make a normal request as a single workspace - If there are multiple IDs, you need to call the API separately for each ID, then aggregate the results (sum, merge lists, etc., depending on the user's intent)
- Note that when using curl, workspace_id should be comma-separated. For example, if $TAPD_WORKSPACE_IDS is "31372104,68119668", then when using curl you need to call
workspace_id=31372104andworkspace_id=68119668
Request template
# 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"}'
Query API documentation
API documentation is located in the ~/.codebuddy/skills/tapd-openapi/references/ directory.
1. List all services:
ls ~/.codebuddy/skills/tapd-openapi/references/
2. List APIs under a service:
ls ~/.codebuddy/skills/tapd-openapi/references/stories/
3. View API details:
cat ~/.codebuddy/skills/tapd-openapi/references/stories/liststories.md
Common services
| Service | Description | Common API files |
|---|---|---|
| stories | Requirement management | liststories, countstories, addstory, updatestory, getrelatedbugs, getstoryfieldsinfo |
| bugs | Defect management | listbugs, countbugs, addbug, updatebug, getbugfieldsinfo |
| iterations | Iteration management | listiterations |
| tasks | Task management | listtasks, counttasks, addtask, updatetask |
| comments | Comment management | listcomments, countcomments, addcomment |
| wikis | Wiki management | listwikis, countwikis, addwiki, updatewiki, searchwiki(see below) |
| timesheets | Timesheet effort | listtimesheets, counttimesheets, addtimesheet, updatetimesheet |
| attachments | Attachment management | listattachments, downloadattachment, getimage, downloaddocument |
| users | User information | getuserinfo, listworkspaces |
Call flow
- Determine the service: choose from common services based on the requirement, or use
lsto view all - Find the API: use
ls ~/.codebuddy/skills/tapd-openapi/references/{服务}/to find the specific operation - Get details: use
catto read the API documentation and obtain the request method, path, and parameters - Execute the request: construct the curl command according to the template,
workspace_idis required
Wiki search
TAPD API does not support Wiki full-text search; this is implemented through a local script. See:
cat ~/.codebuddy/skills/tapd-openapi/references/wikis/searchwiki.md