Skip to content

Commit e8099c8

Browse files
committed
Add comments
1 parent 962575c commit e8099c8

File tree

1 file changed

+56
-26
lines changed

1 file changed

+56
-26
lines changed

Diff for: requests.http

+56-26
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,103 @@
1+
# Fetch all products from the API
12
GET https://bazzar-39eb.onrender.com/api/products
23

34
###
5+
6+
# Register a new user
7+
# Replace YOUR_USERNAME, YOUR_EMAIL, and YOUR_PASSWORD with the user's details
48
curl -X POST https://bazzar-39eb.onrender.com/api/register \
59
-H "Content-Type: application/json" \
610
-d '{
7-
"username": "alex",
8-
"email": "[email protected]",
9-
"password": "senha123"
11+
"username": "YOUR_USERNAME",
12+
"email": "YOUR_EMAIL",
13+
"password": "YOUR_PASSWORD"
1014
}'
1115

1216
###
17+
18+
# Login with an existing user
19+
# Replace YOUR_EMAIL and YOUR_PASSWORD with the user's credentials
1320
curl -X POST https://bazzar-39eb.onrender.com/api/login \
1421
-H "Content-Type: application/json" \
1522
-d '{
16-
"email": "[email protected]",
17-
"password": "senha123"
23+
"email": "YOUR_EMAIL",
24+
"password": "YOUR_PASSWORD"
1825
}'
1926

2027
###
28+
29+
# Add an item to the cart
30+
# Replace YOUR_JWT_TOKEN with the JWT obtained from login
31+
# Replace YOUR_USER_ID, YOUR_PRODUCT_ID, and YOUR_QUANTITY with the relevant details
2132
curl -X POST https://bazzar-39eb.onrender.com/api/cart \
22-
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJhbGV4QHRlc3RlLmNvbSIsImlhdCI6MTcyNjI1MDI2NCwiZXhwIjoxNzI2MjUzODY0fQ.mjvHzrGeXoEPt8zO6U18zP1hSYiswlcUhHplv49wYbM" \
33+
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
2334
-H "Content-Type: application/json" \
2435
-d '{
25-
"user_id": 1,
26-
"product_id": 5,
27-
"quantity": 1
36+
"user_id": YOUR_USER_ID,
37+
"product_id": YOUR_PRODUCT_ID,
38+
"quantity": YOUR_QUANTITY
2839
}'
2940

3041
###
31-
curl -X GET https://bazzar-39eb.onrender.com/api/cart \
32-
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJhbGV4QHRlc3RlLmNvbSIsImlhdCI6MTcyNjI1NTM0OCwiZXhwIjoxNzI2MjU4OTQ4fQ.z2wF3ZG3qHV6nqWlPux7d9a8km5rOw6hMzYUl0KhTs4"
3342

43+
# Retrieve the user's cart items
44+
# Replace YOUR_JWT_TOKEN with the JWT obtained from login
45+
curl -X GET https://bazzar-39eb.onrender.com/api/cart \
46+
-H "Authorization: Bearer YOUR_JWT_TOKEN"
3447

3548
###
36-
curl -X DELETE "https://bazzar-39eb.onrender.com/api/cart/6" \
37-
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJhbGV4QHRlc3RlLmNvbSIsImlhdCI6MTcyNjI0OTgzNCwiZXhwIjoxNzI2MjUzNDM0fQ.YH_8-lPZxkw-dge528CSzVFY_8uTrNgc_R4GkhJqRpw" \
38-
-H "Content-Type: application/json"
39-
4049

50+
# Remove an item from the cart
51+
# Replace YOUR_JWT_TOKEN with the JWT obtained from login
52+
# Replace YOUR_CART_ITEM_ID with the ID of the item you want to remove
53+
curl -X DELETE "https://bazzar-39eb.onrender.com/api/cart/YOUR_CART_ITEM_ID" \
54+
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
55+
-H "Content-Type: application/json"
4156

42-
# Outro Usuário
57+
# Another User
4358

4459
###
60+
61+
# Register another new user
62+
# Replace ANOTHER_USERNAME, ANOTHER_EMAIL, and ANOTHER_PASSWORD with the user's details
4563
curl -X POST https://bazzar-39eb.onrender.com/api/register \
4664
-H "Content-Type: application/json" \
4765
-d '{
48-
"username": "Alex Santos",
49-
"email": "[email protected]",
50-
"password": "senhamuitosegura"
66+
"username": "ANOTHER_USERNAME",
67+
"email": "ANOTHER_EMAIL",
68+
"password": "ANOTHER_PASSWORD"
5169
}'
5270

5371
###
72+
73+
# Login with another existing user
74+
# Replace ANOTHER_EMAIL and ANOTHER_PASSWORD with the user's credentials
5475
curl -X POST https://bazzar-39eb.onrender.com/api/login \
5576
-H "Content-Type: application/json" \
5677
-d '{
57-
"email": "[email protected]",
58-
"password": "senhamuitosegura"
78+
"email": "ANOTHER_EMAIL",
79+
"password": "ANOTHER_PASSWORD"
5980
}'
6081

6182
###
83+
84+
# Add an item to the cart for another user
85+
# Replace ANOTHER_JWT_TOKEN with the JWT obtained from login
86+
# Replace ANOTHER_USER_ID, ANOTHER_PRODUCT_ID, and ANOTHER_QUANTITY with the relevant details
6287
curl -X POST https://bazzar-39eb.onrender.com/api/cart \
63-
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiZW1haWwiOiJhbGV4YW5kcmVAdGVzdGUuY29tIiwiaWF0IjoxNzI2MjQ1NzYyLCJleHAiOjE3MjYyNDkzNjJ9.gHCN9GE9CXPkwAIJuvVtBnkiU_7QTcu-rMm-oQ6lNCQ" \
88+
-H "Authorization: Bearer ANOTHER_JWT_TOKEN" \
6489
-H "Content-Type: application/json" \
6590
-d '{
66-
"user_id": 1,
67-
"product_id": 3,
68-
"quantity": 5
91+
"user_id": ANOTHER_USER_ID,
92+
"product_id": ANOTHER_PRODUCT_ID,
93+
"quantity": ANOTHER_QUANTITY
6994
}'
7095

7196
###
97+
98+
# Retrieve the cart items for another user
99+
# Replace ANOTHER_JWT_TOKEN with the JWT obtained from login
72100
curl -X GET https://bazzar-39eb.onrender.com/api/cart \
73-
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiZW1haWwiOiJhbGV4YW5kcmVAdGVzdGUuY29tIiwiaWF0IjoxNzI2MjQ1NzYyLCJleHAiOjE3MjYyNDkzNjJ9.gHCN9GE9CXPkwAIJuvVtBnkiU_7QTcu-rMm-oQ6lNCQ"
101+
-H "Authorization: Bearer ANOTHER_JWT_TOKEN"
102+
103+
# Note: If you are testing locally, replace the API URL with http://localhost:5000

0 commit comments

Comments
 (0)