-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.http
More file actions
340 lines (266 loc) · 7.99 KB
/
api.http
File metadata and controls
340 lines (266 loc) · 7.99 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
@authorizationUser2 = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuaWNrbmFtZSI6InVsdGlzYWVyIHJldnRlcm5hZSIsImlkIjoiMTA2NjE2ODU4MDc5MTY5NTQ5MzA0IiwiZW1haWwiOiJ1bHRpc2Flci5yZXZ0ZXJuYWVAZ21haWwuY29tIiwiaWF0IjoxNzE4OTgyMTA5LCJleHAiOjE3MTkwNjg1MDl9.C4iORenbbbGVOomoiWQU8HgLUrqI14BSJECUkOVRjGM
@authorizationUser3 = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuaWNrbmFtZSI6Impob25hdGFuIGNhc3RpbGxvIiwiaWQiOiIxMDM2ODk0MjIwNjM5MTc1MTMzMTgiLCJlbWFpbCI6IjAwMXNhcmdlbnRvMDAxQGdtYWlsLmNvbSIsImlhdCI6MTcxODk4NDc4MCwiZXhwIjoxNzE5MDcxMTgwfQ.ED0c5VwvhaRgQJStkIzK-_pSfWrCKtgJguVwn3GyYO8
@baseUrl = http://localhost:3000
@user1 = 106616858079169549304
@user2 = 111802339391429197905
@user3 = 109838121142820694014
@user4 = 103689422063917513318
@user5 = 114508850062700611993
@user6 = e0febc03-18f3-4ad3-ba88-2266fc3c3a51
@group_id = d9c13f9f-2a26-4304-8129-233045ad28e1
@member_id = b09d180b-f031-4139-99a5-545eb076a41e
@moderator_id = 106616858079169549304
@chat_id = 5f1e46a8-1bca-47a1-98e5-44b7335538f6
@username = Ultisaer123
@password = 123456
@email = Ultisaer123@gmail.com
@nickname = 'Ultis'
@urlAvatar = 'https://route.com
@authorization = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuaWNrbmFtZSI6InVsdGVybmFlIiwiaWQiOiIxMTE4MDIzMzkzOTE0MjkxOTc5MDUiLCJlbWFpbCI6InVsdGVybmFlQGdtYWlsLmNvbSIsImlhdCI6MTcyNTM4Mzg1NiwiZXhwIjoxNzI1NDcwMjU2fQ.bidrPcxqTHi2PByG7FxysjslTvhfAvB0NOjoDWmhtrg
// -------------------- Profile ------------------------ //
### Profile
GET {{baseUrl}}/profile HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
// -------------------- Register ----------------------- //
### Register
POST {{baseUrl}}/register HTTP/1.1
Content-Type: application/json
{
"password": "{{password}}",
"email": "{{email}}",
"nickname": "{{nickname}}"
}
### Register google
POST {{baseUrl}}/register/google
Content-Type: application/json
{
"username": "{{username}}",
"password": "{{password}}",
"email": "{{email}}",
"nickname": "{{nickname}}",
"avatar_id": 1
}
// -------------------- Login -------------------------- //
### Login
POST {{baseUrl}}/login
Content-Type: application/json
{
"nickname": "{{nickname}}",
"email": "{{email}}",
"password": "{{password}}"
}
// -------------------- Profile ------------------------ //
### getProfile
GET {{baseUrl}}/profile HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
### updateProfile
POST {{baseUrl}}/login
Content-Type: application/json
Authorization: {{authorization}}
{
"username": "{{username}}",
"password": "{{password}}",
"email": "{{email}}",
"nickname": "{{nickname}}",
"avatar_id": 9
}
// -------------------- Avatars ------------------------ //
### getAvatar
GET {{baseUrl}}/avatars
Content-Type: application/json
Authorization: {{authorization}}
### getAvatar_id
GET {{baseUrl}}/avatars/8
Content-Type: application/json
Authorization: {{authorization}}
### create_avatar
POST {{baseUrl}}/avatars
Content-Type: application/json
Authorization: {{authorization}}
{
"url" : "{{urlAvatar}}"
}
// -------------------- Friends ------------------------ //
### send_request_friend
POST {{baseUrl}}/friends
Content-Type: application/json
Authorization: {{authorizationUser2}}
{
"friend_id" : "{{user2}}"
}
### Friends get all
GET {{baseUrl}}/friends
Content-Type: application/json
Authorization: {{authorization}}
### Friends updateStatus aceptar o rechazar la solicitud de amistas
PUT {{baseUrl}}/friends/{{user6}}/accepted
Content-Type: application/json
Authorization: {{authorization}}
### Friend delete
DELETE {{baseUrl}}/friends/{{user6}}
Content-Type: application/json
Authorization: {{authorization}}
// -------------------- Chat --------------------------- //
### Craete_chat
POST {{baseUrl}}/chats
Content-Type: application/json
Authorization: {{authorization}}
{
"friend_id" : "{{user4}}"
}
### List chats
GET {{baseUrl}}/chats
Content-Type: application/json
Authorization: {{authorization}}
### detailsChatById -- ver diferencias entre chat 1 v 1 y grupal
GET {{baseUrl}}/chats/{{chat_id}}
Content-Type: application/json
Authorization: {{authorization}}
### sendMessage
POST {{baseUrl}}/chats/{{chat_id}}/messages
Content-Type: application/json
Authorization: {{authorization}}
{
"content": "GG"
}
### sendMessageUser2
POST {{baseUrl}}/chats/{{chat_id}}/messages
Content-Type: application/json
Authorization: {{authorizationUser2}}
{
"content": "asd"
}
### sendMessageUser3
POST {{baseUrl}}/chats/{{chat_id}}/messages
Content-Type: application/json
Authorization: {{authorizationUser3}}
{
"content": "3"
}
### getAllMessages
GET {{baseUrl}}/chats/{{chat_id}}/messages
Content-Type: application/json
Authorization: {{authorization}}
// -------------------- Grupos ------------------------- //
### createGroup
POST {{baseUrl}}/groups HTTP/1.1
Content-Type: application/json
Authorization: {{authorizationUser2}}
{
"name": "Grupo publico de Ultisaer",
"description": "JIJIJIJA",
"is_public": true,
"sql" : "DROP TABLE users"
}
### getAllGroups
GET {{baseUrl}}/groups HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
### getGroupById
GET {{baseUrl}}/groups/{{group_id}} HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
### updateGroup
PATCH {{baseUrl}}/groups/{{group_id}} HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
{
"name": "elinia Update ",
"description": "New description"
}
### deleteGroup
DELETE {{baseUrl}}/groups/{{group_id}} HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
// -------------------- Grupos Members ----------------- //
### addMembers
POST {{baseUrl}}/groups/{{group_id}}/members HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
{
"users_ids": [
"IMPOSTOR",
"{{user1}}",
"{{user2}}",
"{{user3}}",
"{{user5}}"
]
}
### deleteMember
DELETE {{baseUrl}}/groups/{{group_id}}/members/{{user3}} HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
### deleteAllMembers
DELETE {{baseUrl}}/groups/{{group_id}}/members/all HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
// -------------------- Grupos Moderatos --------------- //
### assigmentModerators
POST {{baseUrl}}/groups/{{group_id}}/moderators HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
{
"users_ids": [
"{{user1}}" ,
"{{user5}}",
"{{user4}}" ,
"Importor"
]
}
### deleteModerator
DELETE {{baseUrl}}/groups/{{group_id}}/moderators/{{user4}} HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
### deleteAllModerators
DELETE {{baseUrl}}/groups/{{group_id}}/moderators/all HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
// ---------------------------- Group Chats
### Createchat
POST {{baseUrl}}/groups/{{group_id}}/chats HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
{
"name" : "Chat Conectado SUPERR",
"chat_users" : [
"{{user1}}",
"{{user2}}",
"{{user3}}",
"{{user4}}",
"Impostor"
]
}
### Get Chats in Group
GET {{baseUrl}}/groups/{{group_id}}/chats HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
### Get Chat Details in Group
GET {{baseUrl}}/groups/{{group_id}}/chats/{{chat_id}} HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
### Update Chat in Group
PATCH {{baseUrl}}/groups/{{group_id}}/chats/{{chat_id}} HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
{
"name": "NuevoNombreDelChat",
"chat_users": ["{{user1}}", "{{user2}}", "impostor", "{{user4}}" , "{{user5}}"]
}
### Delete
DELETE {{baseUrl}}/groups/{{group_id}}/chats/{{chat_id}} HTTP/1.1
Content-Type: application/json
Authorization: {{authorization}}
// -------------------- Get Users Info Public --------------- //
### Get all users
GET {{baseUrl}}/users
?nickname=r
// -------------------- Join -------------------------------- //
### Get group
POST {{baseUrl}}/join/group
Content-Type: application/json
Authorization: {{authorization}}
{
"group_id": "{{group_id}}"
}