TaskLeef API 文件

用於管理待辦事項、專案與 Kanban 看板的 REST API

上次更新:

身分驗證

此 API 支援兩種身分驗證方式:

1. API 金鑰驗證(建議)

Generate an API key from your Settings page and include it in the X-API-Key header:

curl -H "X-API-Key: your-api-key" \
  https://taskleef.com/api/todos

2. JWT Bearer 權杖

若為瀏覽器應用程式,請透過登入端點進行驗證:

curl -X POST https://taskleef.com/api/login \
  -H "Content-Type: application/json" \
  -d '{"username": "your-username", "password": "your-password"}'

接著在後續請求中夾帶權杖:

curl -H "Authorization: Bearer your-jwt-token" \
  https://taskleef.com/api/todos

待辦事項

GET/api/todos

取得已驗證使用者的所有待辦事項。

curl -H "X-API-Key: your-api-key" \
  https://taskleef.com/api/todos
GET/api/todos/{id}

依 ID 取得特定待辦事項。

GET/api/inbox

取得未指派至任何專案的待辦事項。

POST/api/todos

建立新的待辦事項。

curl -X POST -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"title": "Buy groceries", "description": "Milk, eggs, bread"}' \
  https://taskleef.com/api/todos

請求主體

欄位類型必填說明
titlestringYesTodo title
descriptionstringNoDetailed description
dueDateISO 8601NoDue date/time
prioritystringNoLow, Medium, High, or Urgent
projectIdUUIDNoAssign to a project
PUT/api/todos/{id}

更新現有的待辦事項。

PATCH/api/todos/{id}/complete

切換待辦事項的完成狀態。

curl -X PATCH -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"isCompleted": true}' \
  https://taskleef.com/api/todos/{id}/complete
DELETE/api/todos/{id}

刪除待辦事項。

POST/api/todos/{parentId}/subtasks

在父待辦事項下建立子任務。

curl -X POST -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"title": "Subtask title"}' \
  https://taskleef.com/api/todos/{parentId}/subtasks

專案

GET/api/projects

列出已驗證使用者的所有專案。

POST/api/projects

建立新的專案。

curl -X POST -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"title": "Work Tasks", "description": "Tasks for work"}' \
  https://taskleef.com/api/projects
GET/api/projects/{id}

取得特定專案及其待辦事項。

PUT/api/projects/{id}

更新專案。

DELETE/api/projects/{id}

刪除專案(待辦事項會移至收件匣)。

Kanban 看板

GET/api/boards

列出使用者有權存取的所有看板。

POST/api/boards

建立新的看板。

curl -X POST -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"title": "Sprint Board", "projectId": "project-uuid"}' \
  https://taskleef.com/api/boards
GET/api/boards/{id}

取得特定看板。

GET/api/boards/{boardId}/columns

取得看板的所有欄位。

GET/api/boards/{boardId}/todos

取得在此看板上有卡片的所有待辦事項。

欄位

POST/api/boards/{boardId}/columns

在看板上建立新的欄位。

curl -X POST -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"title": "In Progress", "wipLimit": 3}' \
  https://taskleef.com/api/boards/{boardId}/columns
PUT/api/columns/{id}

更新欄位(標題、WIP 限制、完成標準)。

GET/api/columns/{columnId}/cards

取得欄位中的所有卡片。

DELETE/api/columns/{id}

刪除欄位。

卡片

卡片代表 Kanban 看板上的待辦事項。一個待辦事項可在多個看板上擁有卡片。

POST/api/columns/{columnId}/cards

在欄位中為待辦事項建立卡片。

curl -X POST -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"todoId": "todo-uuid"}' \
  https://taskleef.com/api/columns/{columnId}/cards
PUT/api/cards/{id}

更新卡片(移至不同欄位或子欄位)。

# Move card to a different column
curl -X PUT -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"columnId": "new-column-uuid", "subColumn": "Inbox"}' \
  https://taskleef.com/api/cards/{id}

# Move card to Done subColumn
curl -X PUT -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"subColumn": "Done"}' \
  https://taskleef.com/api/cards/{id}

子欄位值

  • Inbox - Active items in the column
  • Done - Completed items within the column
  • Blocked - Items waiting on external dependencies
DELETE/api/cards/{id}

從看板移除卡片(不會刪除待辦事項)。

標籤

GET/api/tags

列出已驗證使用者的所有標籤。

POST/api/tags

建立新的標籤。

curl -X POST -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"name": "urgent"}' \
  https://taskleef.com/api/tags
PUT/api/tags/{id}

更新標籤。

DELETE/api/tags/{id}

刪除標籤。

留言

GET/api/todos/{todoId}/comments

取得待辦事項的所有留言。

POST/api/todos/{todoId}/comments

為待辦事項新增留言。

curl -X POST -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"text": "This is my comment"}' \
  https://taskleef.com/api/todos/{todoId}/comments
PUT/api/comments/{id}

更新留言。

DELETE/api/comments/{id}

刪除留言。

回應格式

成功回應

成功的請求會回傳含有所需資料的 JSON:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "title": "Buy groceries",
  "description": "Milk, eggs, bread",
  "isCompleted": false,
  "createdAt": "2024-01-15T10:30:00Z"
}

錯誤回應

錯誤會回傳對應的 HTTP 狀態碼:

  • 400 - Bad Request (invalid input)
  • 401 - Unauthorized (missing or invalid authentication)
  • 403 - Forbidden (insufficient permissions)
  • 404 - Not Found
  • 500 - Internal Server Error

Need help? Check your Settings to manage API keys.