-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.http
207 lines (146 loc) · 3.39 KB
/
.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
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
@host = http://localhost:3000
### 1. Register New User
POST {{host}}/register
Content-Type: application/json
{
"email": "[email protected]",
"password": "User@123",
"firstname": "User New"
}
### 2. Login User
# @name login
POST {{host}}/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "User@123",
}
### token
@token = {{login.response.body.token}}
### 3. GET users
GET {{host}}/users
### GET logged-in user
GET {{host}}/users/me
Content-Type: application/json
Authorization: Bearer {{token}}
### 4. GET user by ID
GET {{host}}/users/102
### 5. PATCH uset by ID
PATCH {{host}}/users/101
Authorization: Bearer {{token}}
Content-Type: application/json
{
"firstname": "JohnFirstnameUpdate",
"bio": "Updated bio for the user.",
"city": "New City"
}
### 6. GET user by Invalid ID
GET {{host}}/users/invalid_id
### 7. GET user by Non-Existent ID
GET {{host}}/users/99999
### 8. PATCH user by Invalid ID
PATCH {{host}}/users/invalid_id
Authorization: Bearer {{token}}
Content-Type: application/json
{
"firstname": "InvalidUpdate"
}
### 9. PATCH user without Authorization
PATCH {{host}}/users/101
Content-Type: application/json
{
"firstname": "UnauthorizedUpdate"
}
### 10. DELETE user by ID
DELETE {{host}}/users/101
Authorization: Bearer {{token}}
### 11. DELETE user without Authorization
DELETE {{host}}/users/101
### 12. DELETE Non-Existent User
DELETE {{host}}/users/99999
Authorization: Bearer {{token}}
### 13. Register User with Existing Email
POST {{host}}/register
Content-Type: application/json
{
"email": "[email protected]",
"password": "123",
"firstname": "DuplicateUser"
}
### 14. Register User with Missing Fields
POST {{host}}/register
Content-Type: application/json
{
"email": "[email protected]",
"password": "123"
// Missing "firstname"
}
### 15. Login with Incorrect Password
POST {{host}}/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "1234"
}
### 16. Update Password Test Case
PATCH http://localhost:3000/users/101/password
Content-Type: application/json
Authorization: Bearer {{token}}
{
"currentPassword": "123",
"newPassword": "321"
}
### GET interests
GET {{host}}/interests
### POST interests
POST {{host}}/interests
Content-Type: application/json
{
"interest": "Running"
}
### GET events
GET {{host}}/events
### GET events/:id
GET {{host}}/events/2
###POST attending
@token = {{login.response.body.token}}
POST {{host}}/events/2/attendingUsers
Authorization: Bearer {{token}}
###POST not attending
@token = {{login.response.body.token}}
DELETE {{host}}/events/2/attendingUsers
Authorization: Bearer {{token}}
// CHATS ENDPOINTS
### POST New Chat
@token = {{login.response.body.token}}
POST {{host}}/chats
Authorization: Bearer {{token}}
Content-Type: application/json
{
"firstId": 101,
"secondId": 102
}
### GET Specific user chats
GET {{host}}/chats/user-chats
Authorization: Bearer {{token}}
### GET Chat between two users
GET {{host}}/chats
Authorization: Bearer {{token}}
Content-Type: application/json
{
"firstId": 101,
"secondId": 102
}
//Messages Endpoints
### POST a message
POST {{host}}/messages
Authorization: Bearer {{token}}
Content-Type: application/json
{
"chatId": 1,
"senderId": 102,
"text": "sdafsafdsfasfdsfsdfsdafdsafdsfsafsdfasfsdafsdfsfsdfsdsf"
}
### Get all messages from one chat
GET {{host}}/messages/1
Authorization: Bearer {{token}}