CH

CodeHub

API Playground

← All collections

Collection Docs

Tasks Collection

Task management demonstrating PATCH partial updates and boolean toggles.

Fields

text

title

Required; task title.

textarea

description

Optional; detailed task description.

select

priority

Required enum: low, medium, high. Defaults to medium.

date

dueDate

Optional; task due date.

checkbox

completed

Boolean; defaults to false.

REST Endpoints

GET/api/tasks

List tasks. Filter by completed status or priority.

GET/api/tasks/:id

Fetch one task by document ID.

POST/api/tasks

Create a task. Include title, description, priority, dueDate, completed.

PATCH/api/tasks/:id

Partial update. Send only fields to change (e.g., {"completed": true}).

DELETE/api/tasks/:id

Delete a task document.

Teaching Tips

  • Toggle completed: PATCH with {"completed": true}
  • Update only priority: PATCH with {"priority": "high"}
  • Filter incomplete: ?where[completed][equals]=false
  • PATCH allows partial updates—only send fields you want to change.