-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequests.http
More file actions
474 lines (397 loc) · 11 KB
/
Copy pathrequests.http
File metadata and controls
474 lines (397 loc) · 11 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
@baseURL=http://localhost:3000/api/v1
###
# Register a new admin user
POST {{baseURL}}/auth/register
Content-Type: application/json
{
"email": "admin@example.com",
"password": "securePass123"
}
###
# Login with admin credentials
# @name adminLogin
@adminRefreshToken={{adminLogin.response.body.$.refresh_token}}
POST {{baseURL}}/auth/login
Content-Type: application/json
{
"email": "admin@example.com",
"password": "securePass123"
}
###
# Refresh admin access token
# Uses refresh_token from the login response
# @name adminRefresh
@adminAccessToken={{adminRefresh.response.body.$.access_token}}
@adminRefreshToken={{adminRefresh.response.body.$.refresh_token}}
POST {{baseURL}}/auth/refresh
Content-Type: application/json
{
"refresh_token": "{{adminRefreshToken}}"
}
###
# Logout admin (revokes refresh token)
POST {{baseURL}}/auth/logout
Content-Type: application/json
{
"refresh_token": "{{adminRefreshToken}}"
}
###
# Register a new user
# @name register
@email={{register.request.body.$.email}}
@userID={{register.response.body.$.id}}
POST {{baseURL}}/auth/register
Content-Type: application/json
{
"email": "user{{$randomInt 10 100}}@example.com",
"password": "securePass123"
}
###
# Login with user credentials
# @name login
@accessToken={{login.response.body.$.access_token}}
@refreshToken={{login.response.body.$.refresh_token}}
POST {{baseURL}}/auth/login
Content-Type: application/json
{
"email": "{{email}}",
"password": "securePass123"
}
###
# Refresh user access token
# Uses refresh_token from the login response
# @name userRefresh
@accessToken={{userRefresh.response.body.$.access_token}}
@refreshToken={{userRefresh.response.body.$.refresh_token}}
POST {{baseURL}}/auth/refresh
Content-Type: application/json
{
"refresh_token": "{{refreshToken}}"
}
###
# Logout user (revokes refresh token)
POST {{baseURL}}/auth/logout
Content-Type: application/json
{
"refresh_token": "{{refreshToken}}"
}
###
# Change password (requires authentication)
POST {{baseURL}}/auth/change-password
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"old_password": "securePass123",
"new_password": "newStrongPass456"
}
###
# List all users (admin only)
# Requires admin JWT token in Authorization header
# Optional query parameters: status (pending/active/blocked), role (admin/user), limit, offset
GET {{baseURL}}/users?status=pending
Authorization: Bearer {{adminAccessToken}}
###
# Search active users by name (authenticated users)
# Requires authentication JWT token in Authorization header
# Query params: name=<prefix>, limit, offset
GET {{baseURL}}/users/search?name=user
Authorization: Bearer {{accessToken}}
###
# Update user status/role (admin only)
# Requires admin JWT token in Authorization header
PATCH {{baseURL}}/users/{{userID}}
Content-Type: application/json
Authorization: Bearer {{adminAccessToken}}
{
"status": "active",
"role": "user"
}
###
# Example: Activate a pending user
PATCH {{baseURL}}/users/2
Content-Type: application/json
Authorization: Bearer {{adminAccessToken}}
{
"status": "active"
}
###
# Example: Block a user
PATCH {{baseURL}}/users/3
Content-Type: application/json
Authorization: Bearer {{adminAccessToken}}
{
"status": "blocked"
}
###
# Example: Promote user to admin
PATCH {{baseURL}}/users/4
Content-Type: application/json
Authorization: Bearer {{adminAccessToken}}
{
"role": "admin"
}
###
# List all projects (authenticated users)
# Optional query parameters: limit (max 100), offset
GET {{baseURL}}/projects?limit=20&offset=0
Authorization: Bearer {{accessToken}}
###
# Get project by ID (authenticated users)
# Returns detailed information about a specific project
GET {{baseURL}}/projects/my-new-project
Authorization: Bearer {{accessToken}}
###
# Create a new project (admin only)
# Requires admin JWT token in Authorization header
POST {{baseURL}}/projects
Content-Type: application/json
Authorization: Bearer {{adminAccessToken}}
{
"name": "My New Project",
"repo_url": "https://bitbucket.org/company/repo.git"
}
###
# Update a project (admin only)
# Requires admin JWT token in Authorization header
# All fields are optional - only provided fields will be updated
PATCH {{baseURL}}/projects/my-new-project
Content-Type: application/json
Authorization: Bearer {{adminAccessToken}}
{
"name": "Updated Project Name",
"repo_url": "https://bitbucket.org/company/new-repo.git"
}
###
# Update only the project name (admin only)
PATCH {{baseURL}}/projects/my-new-project
Content-Type: application/json
Authorization: Bearer {{adminAccessToken}}
{
"name": "New Project Name"
}
###
# Update only the repository URL (admin only)
PATCH {{baseURL}}/projects/my-new-project
Content-Type: application/json
Authorization: Bearer {{adminAccessToken}}
{
"repo_url": "https://bitbucket.org/company/updated-repo.git"
}
###
# Delete a project (admin only)
# WARNING: This permanently deletes the project and all associated tasks, comments, and attachments
DELETE {{baseURL}}/projects/my-new-project
Authorization: Bearer {{adminAccessToken}}
###
# Tasks API
###
# List all tasks (authenticated users)
# Optional query parameters: project, author, assignee, statuses, priorities, sort, limit, offset
GET {{baseURL}}/tasks?limit=20&offset=0
Authorization: Bearer {{accessToken}}
###
# List tasks with filters
# Filter by project, status, priority, author, assignee, and date ranges
GET {{baseURL}}/tasks?project=my-new-project&statuses=New,Open,In%20Progress&priorities=Major,Critical&sort=-priority
Authorization: Bearer {{accessToken}}
###
# Get my tasks (tasks assigned to or created by current user)
# Returns tasks sorted by created_at descending
GET {{baseURL}}/tasks/me
Authorization: Bearer {{accessToken}}
###
# Get task by ID
GET {{baseURL}}/tasks/{{taskId}}
Authorization: Bearer {{accessToken}}
###
# Create a new task
# POST to /tasks
# @name createTask
@taskId={{createTask.response.body.$.id}}
POST {{baseURL}}/tasks
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"project_slug": "my-new-project",
"title": "Implement user authentication",
"description": "# Overview\nAdd JWT-based authentication to the API.\n\n## Requirements\n- Login endpoint\n- Token validation middleware",
"priority": "Major",
"due_date": "2026-04-20",
"assignee_id": {{userID}}
}
###
# Create a task with minimal data
# @name createTask
@taskId={{createTask.response.body.$.id}}
POST {{baseURL}}/tasks
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"project_slug": "my-new-project",
"title": "Fix bug in task numbering"
}
###
# Update a task
PATCH {{baseURL}}/tasks/{{taskId}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"title": "Implement user authentication (Updated)",
"description": "# Overview\nAdd JWT-based authentication to the API.\n\n## Requirements\n- Login endpoint\n- Token validation middleware\n- Logout endpoint",
"priority": "Critical",
"status": "In Progress",
"assignee_id": 1,
"due_date": "2026-04-18"
}
###
# Update only the status of a task
PATCH {{baseURL}}/tasks/{{taskId}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"status": "Resolved"
}
###
# Update only the due date (set to NULL to clear)
PATCH {{baseURL}}/tasks/{{taskId}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"due_date": ""
}
###
# Delete a task (soft delete)
DELETE {{baseURL}}/tasks/{{taskId}}
Authorization: Bearer {{accessToken}}
###
# Comments API
###
# Create a new comment on a task
# @name createComment
POST {{baseURL}}/tasks/{{taskId}}/comments
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"content": "This is a comment on the task"
}
###
# Create another comment on the same task
POST {{baseURL}}/tasks/{{taskId}}/comments
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"content": "Another comment with more details about the task"
}
###
# Update a comment
# Requires comment ID from createComment response
@commentId={{createComment.response.body.$.id}}
PUT {{baseURL}}/tasks/{{taskId}}/comments/{{commentId}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"content": "Updated comment content"
}
###
# Delete a comment
# Requires comment ID from createComment response
DELETE {{baseURL}}/tasks/{{taskId}}/comments/{{commentId}}
Authorization: Bearer {{accessToken}}
###
# Get task with comments (comments are included in task details)
GET {{baseURL}}/tasks/{{taskId}}
Authorization: Bearer {{accessToken}}
###
# Attachments API
###
# Initialize an attachment upload
# @name initAttachmentUpload
@attachmentId={{initAttachmentUpload.response.body.$.id}}
@uploadURL={{initAttachmentUpload.response.body.$.upload_url}}
POST {{baseURL}}/tasks/{{taskId}}/attachments
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"file_name": "LICENSE",
"size_bytes": 11358
}
###
# Upload file using presigned URL
# Note: Use the upload_url from the initAttachmentUpload response
PUT {{uploadURL}}
Content-Type: application/octet-stream
< ./LICENSE
###
# Confirm attachment upload
# Required after uploading - commits the attachment
PUT {{baseURL}}/tasks/{{taskId}}/attachments/{{attachmentId}}/confirm
Authorization: Bearer {{accessToken}}
###
# Get attachment download URL
# @name getDownloadURL
@downloadURL={{getDownloadURL.response.body.$.download_url}}
GET {{baseURL}}/tasks/{{taskId}}/attachments/{{attachmentId}}/download
Authorization: Bearer {{accessToken}}
###
# Download file using presigned URL
# Note: Use the download_url from the download response
GET {{downloadURL}}
###
# Delete an attachment
# Requires attachment ID from initAttachmentUpload response
DELETE {{baseURL}}/tasks/{{taskId}}/attachments/{{attachmentId}}
Authorization: Bearer {{accessToken}}
###
# BitBucket Webhook Push Event (fixes #2)
# Public endpoint — no JWT auth required
# Secret key: mysecret
POST {{baseURL}}/webhooks/bitbucket/push
Content-Type: application/json
X-Hub-Signature-256: sha256=b591780f12804490e0e8b437be235dcbb6ccc2ac9087053f2b3116bf09c5a692
{
"push": {
"changes": [
{
"commits": [
{
"hash": "a1b2c3d4e5f6789012345678901234567890abcdef",
"message": "Fix login redirect loop\n\nfixes #2",
"author": {"nickname": "dev1"},
"date": "2026-06-25T10:00:00+00:00"
}
]
}
]
},
"repository": {
"full_name": "my-org/my-repo"
},
"actor": {"nickname": "dev1"}
}
###
# BitBucket Webhook Push Event (bare mention #1)
# Public endpoint — no JWT auth required
# Secret key: mysecret
POST {{baseURL}}/webhooks/bitbucket/push
Content-Type: application/json
X-Hub-Signature-256: sha256=c8d3e58153ab0c75626df9ef241dd1240d748a922592fb05e17909ae658b088b
{
"push": {
"changes": [
{
"commits": [
{
"hash": "f0e0d0c0b0a09080706050403020100000000000",
"message": "Refactored related code\n\nsee #1",
"author": {"nickname": "dev1"},
"date": "2026-06-25T11:00:00+00:00"
}
]
}
]
},
"repository": {
"full_name": "my-org/my-repo"
},
"actor": {"nickname": "dev1"}
}