All endpoints require authentication. Use these headers:
# Admin access (create/update/delete)
-H "Authorization: Bearer secret-admin-123"
# User access (read-only)
-H "Authorization: Bearer secret-user-123"GET /tasksReturns array of all tasks.
GET /tasks/:idReturns a specific task by ID.
POST /tasks
Content-Type: application/json
{
"title": "Task name",
"priority": 5,
"dependencies": []
}Returns the created task with generated ID.
PUT /tasks/:id
Content-Type: application/json
{
"title": "New title",
"priority": 8
}Returns updated task.
DELETE /tasks/:idReturns success.
GET /tasks/queueReturns the internal Max-Heap structure (for learning).
GET /tasks/peekSame as /tasks/next, returns top priority task.
GET /tasks/nextReturns highest priority task without removing it.
GET /tasks/resolveReturns execution order for all tasks (topological sort).
Status codes:
200— Success, execution order found409— Conflict, cycle detected (impossible)422— Unprocessable, missing dependency
GET /tasks/:id/resolveReturns execution order for this task and its dependencies.
GET /tasks/export.csvReturns tasks as CSV, suitable for Excel/Google Sheets.
GET /tasks/stream.ndjsonReturns tasks as newline-delimited JSON, one per line.
POST /tasks/reports/start?heavyIterations=1000000Starts CPU-intensive report in worker thread.
Returns:
{ "jobId": "abc-123-def" }GET /tasks/reports/:jobIdReturns one of:
{ "status": "processing", "progress": "..." }
{ "status": "complete", "result": 123456 }
{ "status": "error", "error": "..." }GET /tasks/reports/statsReturns worker pool statistics.
GET /tasks/system/memoryReturns heap usage, RSS, and garbage collection info.
GET /tasks/system/wsReturns number of connected clients and active subscriptions.
WS /ws/tasksListen for events:
{ "event": "task.created", "task": { ... } }
{ "event": "task.updated", "task": { ... } }
{ "event": "task.deleted", "taskId": "..." }All errors follow this format:
{
"error": "Human-readable message",
"code": "MACHINE_CODE",
"httpStatus": 400,
"requestId": "request-uuid",
"timestamp": "2024-01-15T10:30:00Z"
}Common status codes:
200— Success201— Created400— Bad request (invalid data)401— Unauthorized (missing/invalid token)403— Forbidden (insufficient permissions)404— Not found409— Conflict (cycle detected)422— Unprocessable entity (malformed data)500— Server error
See scripts/full-demo.sh for comprehensive examples of every endpoint.