-
Notifications
You must be signed in to change notification settings - Fork 0
/
requests.http
103 lines (83 loc) · 2.92 KB
/
requests.http
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
# Fetch all products from the API
GET https://bazzar-39eb.onrender.com/api/products
###
# Register a new user
# Replace YOUR_USERNAME, YOUR_EMAIL, and YOUR_PASSWORD with the user's details
curl -X POST https://bazzar-39eb.onrender.com/api/register \
-H "Content-Type: application/json" \
-d '{
"username": "YOUR_USERNAME",
"email": "YOUR_EMAIL",
"password": "YOUR_PASSWORD"
}'
###
# Login with an existing user
# Replace YOUR_EMAIL and YOUR_PASSWORD with the user's credentials
curl -X POST https://bazzar-39eb.onrender.com/api/login \
-H "Content-Type: application/json" \
-d '{
"email": "YOUR_EMAIL",
"password": "YOUR_PASSWORD"
}'
###
# Add an item to the cart
# Replace YOUR_JWT_TOKEN with the JWT obtained from login
# Replace YOUR_USER_ID, YOUR_PRODUCT_ID, and YOUR_QUANTITY with the relevant details
curl -X POST https://bazzar-39eb.onrender.com/api/cart \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"user_id": YOUR_USER_ID,
"product_id": YOUR_PRODUCT_ID,
"quantity": YOUR_QUANTITY
}'
###
# Retrieve the user's cart items
# Replace YOUR_JWT_TOKEN with the JWT obtained from login
curl -X GET https://bazzar-39eb.onrender.com/api/cart \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
###
# Remove an item from the cart
# Replace YOUR_JWT_TOKEN with the JWT obtained from login
# Replace YOUR_CART_ITEM_ID with the ID of the item you want to remove
curl -X DELETE "https://bazzar-39eb.onrender.com/api/cart/YOUR_CART_ITEM_ID" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json"
# Another User
###
# Register another new user
# Replace ANOTHER_USERNAME, ANOTHER_EMAIL, and ANOTHER_PASSWORD with the user's details
curl -X POST https://bazzar-39eb.onrender.com/api/register \
-H "Content-Type: application/json" \
-d '{
"username": "ANOTHER_USERNAME",
"email": "ANOTHER_EMAIL",
"password": "ANOTHER_PASSWORD"
}'
###
# Login with another existing user
# Replace ANOTHER_EMAIL and ANOTHER_PASSWORD with the user's credentials
curl -X POST https://bazzar-39eb.onrender.com/api/login \
-H "Content-Type: application/json" \
-d '{
"email": "ANOTHER_EMAIL",
"password": "ANOTHER_PASSWORD"
}'
###
# Add an item to the cart for another user
# Replace ANOTHER_JWT_TOKEN with the JWT obtained from login
# Replace ANOTHER_USER_ID, ANOTHER_PRODUCT_ID, and ANOTHER_QUANTITY with the relevant details
curl -X POST https://bazzar-39eb.onrender.com/api/cart \
-H "Authorization: Bearer ANOTHER_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"user_id": ANOTHER_USER_ID,
"product_id": ANOTHER_PRODUCT_ID,
"quantity": ANOTHER_QUANTITY
}'
###
# Retrieve the cart items for another user
# Replace ANOTHER_JWT_TOKEN with the JWT obtained from login
curl -X GET https://bazzar-39eb.onrender.com/api/cart \
-H "Authorization: Bearer ANOTHER_JWT_TOKEN"
# Note: If you are testing locally, replace the API URL with http://localhost:5000