65 lines
1.9 KiB
Markdown
65 lines
1.9 KiB
Markdown
---
|
|
title: Vikunja API Integration
|
|
name: vikunja-api-integration
|
|
description: Automate interaction with local Vikunja instance for project and task management.
|
|
---
|
|
|
|
# Vikunja API Integration
|
|
|
|
## Current Status
|
|
- ❌ **Authentication Required**: All API calls return 401 Unauthorized
|
|
- ⚠️ **Missing Token**: Need valid JWT Bearer Token to access data
|
|
- ✅ **System Healthy**: Vikunja container running on localhost:3456
|
|
|
|
## Purpose
|
|
Automate interaction with local Vikunja instance for project and task management.
|
|
|
|
## Prerequisites
|
|
- Vikunja Docker container running on localhost:3456
|
|
- Valid JWT Bearer Token for authentication
|
|
|
|
## Key Endpoints
|
|
- GET /api/v1/projects - List all projects
|
|
- GET /api/v1/projects/{id} - Get specific project details
|
|
- GET /api/v1/projects/{id}/tasks - List tasks for project
|
|
- POST /api/v1/tasks/{id} - Update task status
|
|
|
|
## Authentication
|
|
```bash
|
|
curl -H "Authorization: Bearer <TOKEN>" \
|
|
"http://localhost:3456/api/v1/projects"
|
|
```
|
|
|
|
## Common Issues
|
|
- 401 Unauthorized: Invalid/missing token
|
|
- 429 Too Many Requests: Rate limiting
|
|
|
|
## Workflow
|
|
1. Get project list to find project ID by title
|
|
2. Query tasks for specific project ID
|
|
3. Filter tasks by completion status
|
|
|
|
## Example Commands
|
|
```bash
|
|
# Get projects
|
|
curl -s -H "Authorization: Bearer <TOKEN>" \
|
|
"http://localhost:3456/api/v1/projects" | python3 -m json.tool
|
|
|
|
# Get tasks for project ID 5
|
|
curl -s -H "Authorization: Bearer <TOKEN>" \
|
|
"http://localhost:3456/api/v1/projects/5/tasks" | python3 -m json.tool
|
|
|
|
# Filter incomplete tasks
|
|
curl -s -H "Authorization: Bearer <TOKEN>" \
|
|
"http://localhost:3456/api/v1/projects/5/tasks" | \
|
|
python3 -c "
|
|
import sys, json
|
|
data = json.load(sys.stdin)
|
|
incomplete = [t for t in data if not t['done']]
|
|
if incomplete:
|
|
for t in incomplete:
|
|
print(f'ID: {t[\"id\"]} | 标题: {t[\"title\"]}')
|
|
else:
|
|
print('当前无未完成任务')
|
|
"
|
|
``` |