Repository navigation
Expand file tree
/
Copy pathapi.http
More file actions
214 lines (166 loc) · 5.79 KB
/
Copy pathapi.http
File metadata and controls
214 lines (166 loc) · 5.79 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
@base = http://localhost:8000
### Health Check
GET {{base}}/health
### ═══════════════════════════════════════════════════════
### ─── ANALYTICS ──────────────────────────────────────────
### ═══════════════════════════════════════════════════════
### 1. Get Total Inventory Value
GET {{base}}/products/total_value
### ═══════════════════════════════════════════════════════
### ─── PRODUCTS ──────────────────────────────────────────
### ═══════════════════════════════════════════════════════
### 2. Get All Products
GET {{base}}/products
### 3. Get All Products - With Pagination
GET {{base}}/products?offset=0&limit=10
### 4. Get Product by ID
GET {{base}}/products/1
### 5. Create Product - Tee
POST {{base}}/products
Content-Type: application/json
{
"category": "Tees",
"name": "Classic White Tee",
"color": "WHITE",
"price": 29.99,
"collection": "SS26",
"coming_soon": false
}
### 6. Create Product - Hoodie
POST {{base}}/products
Content-Type: application/json
{
"category": "Sweaters",
"name": "Oversized Hoodie",
"color": "BLACK",
"price": 89.99,
"collection": "FW25",
"coming_soon": false
}
### 7. Create Product - Coming Soon
POST {{base}}/products
Content-Type: application/json
{
"category": "Pants",
"name": "Cargo Pants",
"color": "OLIVE",
"price": 119.99,
"collection": "SS26",
"coming_soon": true
}
### 8. Update Product - Change Price
PATCH {{base}}/products/1
Content-Type: application/json
{
"price": 24.99
}
### 9. Update Product - Mark as Coming Soon
PATCH {{base}}/products/1
Content-Type: application/json
{
"coming_soon": true
}
### 10. Delete Product
DELETE {{base}}/products/1
### ═══════════════════════════════════════════════════════
### ─── VARIANTS ───────────────────────────────────────────
### ═══════════════════════════════════════════════════════
### 11. Get All Variants for a Product
GET {{base}}/products/1/variants
### 12. Create Variant - S-M
POST {{base}}/products/1/variants
Content-Type: application/json
{
"size": "S-M",
"quantity": 50,
"in_stock": true
}
### 13. Create Variant - L-XL
POST {{base}}/products/1/variants
Content-Type: application/json
{
"size": "L-XL",
"quantity": 30,
"in_stock": true
}
### 14. Create Variant - One Size
POST {{base}}/products/1/variants
Content-Type: application/json
{
"size": "OS",
"quantity": 0,
"in_stock": false
}
### 15. Update Variant - Restock
PATCH {{base}}/products/1/variants/1
Content-Type: application/json
{
"quantity": 100,
"in_stock": true
}
### 16. Delete Variant
DELETE {{base}}/products/1/variants/1
### ═══════════════════════════════════════════════════════
### ─── VALIDATION TESTS (all should return 422) ──────────
### ═══════════════════════════════════════════════════════
### 17. Create Product - Missing required fields
POST {{base}}/products
Content-Type: application/json
{
"name": "Incomplete Product"
}
### 18. Create Product - Invalid category
POST {{base}}/products
Content-Type: application/json
{
"category": "INVALID_CATEGORY",
"name": "Bad Product",
"color": "BLACK",
"price": 29.99,
"collection": "SS26",
"coming_soon": false
}
### 19. Create Product - Negative price
POST {{base}}/products
Content-Type: application/json
{
"category": "Tees",
"name": "Bad Product",
"color": "BLACK",
"price": -10,
"collection": "SS26",
"coming_soon": false
}
### 20. Create Variant - Invalid size
POST {{base}}/products/1/variants
Content-Type: application/json
{
"size": "XXXL",
"quantity": 10,
"in_stock": true
}
### ═══════════════════════════════════════════════════════
### ─── ERROR HANDLING TESTS ─────────────────────────────
### ═══════════════════════════════════════════════════════
### 21. Get Non-existent Product (should return 404)
GET {{base}}/products/9999
### 22. Update Non-existent Product (should return 404)
PATCH {{base}}/products/9999
Content-Type: application/json
{
"price": 9.99
}
### 23. Delete Non-existent Product (should return 404)
DELETE {{base}}/products/9999
### 24. Get Variants for Non-existent Product (should return 404)
GET {{base}}/products/9999/variants
### 25. Update Non-existent Variant (should return 404)
PATCH {{base}}/products/1/variants/9999
Content-Type: application/json
{
"quantity": 10
}
### 26. Delete Non-existent Variant (should return 404)
DELETE {{base}}/products/1/variants/9999
### 27. Non-existent Route (should return 404)
GET {{base}}/does-not-exist