-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.http
More file actions
140 lines (108 loc) · 3.28 KB
/
api.http
File metadata and controls
140 lines (108 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
### Todo API Test File
### Base URL: http://localhost:3001
### 1. Get all todos (default)
GET http://localhost:3001/api/todos
### 2. Get all todos with status filter (active)
GET http://localhost:3001/api/todos?status=active
### 3. Get all todos with status filter (completed)
GET http://localhost:3001/api/todos?status=completed
### 4. Get todos with search
GET http://localhost:3001/api/todos?search=test
### 5. Get todos with sorting (by dueDate, ascending)
GET http://localhost:3001/api/todos?sortBy=dueDate&sortDir=asc
### 6. Get todos with multiple filters
GET http://localhost:3001/api/todos?status=active&sortBy=order&sortDir=asc
### 7. Create a new todo
POST http://localhost:3001/api/todos
Content-Type: application/json
{
"title": "Test Todo Item",
"notes": "This is a test todo created via API",
"tags": ["test", "api"],
"dueDate": "2024-12-31T23:59:59.000Z",
"order": 10
}
### 8. Create a minimal todo
POST http://localhost:3001/api/todos
Content-Type: application/json
{
"title": "Minimal Todo"
}
### 9. Get a specific todo by ID (replace with actual ID)
GET http://localhost:3001/api/todos/clxyz1234567890abcdef
### 10. Update a todo (partial update)
PATCH http://localhost:3001/api/todos/clxyz1234567890abcdef
Content-Type: application/json
{
"completed": true,
"notes": "Updated notes for this todo"
}
### 11. Update todo title and tags
PATCH http://localhost:3001/api/todos/clxyz1234567890abcdef
Content-Type: application/json
{
"title": "Updated Todo Title",
"tags": ["updated", "modified"]
}
### 12. Toggle todo completion status
PATCH http://localhost:3001/api/todos/clxyz1234567890abcdef
Content-Type: application/json
{
"completed": false
}
### 13. Delete a todo
DELETE http://localhost:3001/api/todos/clxyz1234567890abcdef
### 14. Bulk action - Complete all todos
PATCH http://localhost:3001/api/todos/bulk
Content-Type: application/json
{
"action": "completeAll",
"payload": {
"completed": true
}
}
### 15. Bulk action - Uncomplete all todos
PATCH http://localhost:3001/api/todos/bulk
Content-Type: application/json
{
"action": "completeAll",
"payload": {
"completed": false
}
}
### 16. Bulk action - Clear completed todos
PATCH http://localhost:3001/api/todos/bulk
Content-Type: application/json
{
"action": "clearCompleted",
"payload": {}
}
### 17. Bulk action - Reorder todos
PATCH http://localhost:3001/api/todos/bulk
Content-Type: application/json
{
"action": "reorder",
"payload": {
"orders": [
{ "id": "clxyz1234567890abcdef", "order": 1 },
{ "id": "clxyz2345678901bcdefg", "order": 2 },
{ "id": "clxyz3456789012cdefgh", "order": 3 }
]
}
}
### 18. Test validation error - Invalid title (empty)
POST http://localhost:3001/api/todos
Content-Type: application/json
{
"title": ""
}
### 19. Test validation error - Title too long
POST http://localhost:3001/api/todos
Content-Type: application/json
{
"title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
}
### 20. Test 404 error - Non-existent todo
GET http://localhost:3001/api/todos/non-existent-id
### 21. Test OPTIONS (CORS preflight)
OPTIONS http://localhost:3001/api/todos