-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiary.apib
456 lines (320 loc) · 9.71 KB
/
apiary.apib
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
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# Target
Target project.
## Users Collection [/api/v1/users]
For GENDER attribute, possible values are: __'male'__, __'female'__ and __'other'__
### Sign Up [POST]
+ Request (application/json)
+ Attributes
+ user (User Edition, required)
+ Response 200 (application/json)
+ Headers
access-token: -abG_2b-LZMm_mJxz6dlGg
client: SOn5zDcJF_pkmGvTF_5eMQ
expiry: 1601058505
uid: test@test.com
+ Attributes
+ user (User Response, required)
+ Response 422
## Update current user profile [/api/v1/users/{id}]
### Update current user profile [PUT]
+ Request (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
uid: test@test.com
+ Attributes
+ user (User Update Edition, required)
+ Response 200 (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
expiry: 1489009792
uid: testing@test.com
+ Attributes
+ user (User Response, required)
## Get user's profile [/api/v1/users/{id}]
### Get user [GET]
+ Request (application/json)
+ Parameters
+ id (integer, required)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
uid: test@test.com
+ Response 200 (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
expiry: 1489009792
uid: test@test.com
+ Attributes
+ user (User Response, required)
+ Response 401
## Log In [/api/v1/users/sign_in]
### Log In [POST]
+ Request (application/json)
+ Body
{
"user":
{
"email": "test@test.com",
"password": "password"
}
}
+ Response 200 (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
expiry: 1489009792
uid: test@test.com
+ Attributes
+ user (User Response, required)
+ Response 401
## Facebook Log In [/api/v1/users/facebook]
### Facebook Log In [POST]
+ Response 200 (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
uid: test@test.com
+ Attributes
+ user (User Facebook Response, required)
## Log out [/api/v1/users/sign_out]
### Log out [DELETE]
+ Request (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
expiry: 1489009792
uid: test@test.com
+ Response 200 (application/json)
+ Response 404
+ Body
{
"error": "User was not found or was not logged in."
}
## Reset password [/api/v1/users/password]
https://github.com/lynndylanhurley/devise_token_auth/wiki/Reset-Password-Flow
### Reset password [POST]
Use this route to send a password reset confirmation email
+ Request (application/json)
+ Body
{
"email": "test@test.com",
"redirect_url": "http://www.example.com"
}
+ Response 200 (application/json)
+ Body
{
"success": true,
"message": "An email has been sent to 'example@mail.com' containing instructions for resetting your password."
}
## Edit reset password [/api/v1/users/password/edit]
### Edit reset password [GET]
This route is the destination URL for password reset confirmation
+ Request (application/json)
+ Parameters
+ reset_password_token (string, required)
+ redirect_url (string)
+ Response 200 (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
expiry: 1489009792
uid: test@test.com
### Reset password [PUT]
Use this route to change user's passwords
+ Request (application/json)
+ Headers
access-token: -abG_2b-LZMm_mJxz6dlGg
client: SOn5zDcJF_pkmGvTF_5eMQ
uid: test@test.com
+ Body
{
"password": "12345678",
"password_confirmation": "12345678"
}
+ Response 200 (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
expiry: 1489009792
uid: test@test.com
+ Attributes
+ user (User Response, required)
## Topics Collection [/api/v1/topics]
### Get Topics [GET]
+ Request (application/json)
+ Headers
access-token: 0JfjvKLv7NR3_d10350u2w
client: pBx8B5nowYy3L-EXueP6nQ
uid: test@test.com
token-type: Bearer
+ Response 200 (application/json)
+ Attributes
+ topics (Topics Collection)
## Spot Collection [/api/v1/spots]
### Create Spot [POST]
+ Request (application/json)
+ Headers
access-token: Aq0GCbYKWFA0oAbcvRzP9g
client: 0WPgnm5Ns79vEqh1O81Akg
uid: test@test.com
token-type: Bearer
+ Attributes
+ spot (Spot, required)
+ Response 200 (application/json)
+ Attributes
+ spot (Spot, required)
+ matches (Min Details Matches Collection)
### Get Spots [GET]
+ Request (application/json)
+ Headers
access-token: Aq0GCbYKWFA0oAbcvRzP9g
client: 0WPgnm5Ns79vEqh1O81Akg
uid: test@test.com
token-type: Bearer
+ Response 200 (application/json)
+ Attributes
+ spots (Spots Collection)
## Delete spot [/api/v1/spots/{id}]
### Delete spot [DELETE]
+ Request (application/json)
+ Headers
access-token: sO2bm_Bpdyoo8r78jZ-fqg
client: QADgNCWRJj0LyRruqzYbBg
expiry: 1489009792
uid: test@test.com
+ Response 204 (application/json)
+ Response 404
+ Body
{
"error": "Couldn't find the record"
}
## Match Collection [/api/v1/users/matches]
### Get Matches [GET]
+ Request (application/json)
+ Headers
access-token: Aq0GCbYKWFA0oAbcvRzP9g
client: 0WPgnm5Ns79vEqh1O81Akg
uid: test@test.com
token-type: Bearer
+ Response 200 (application/json)
+ Attributes
+ matches (Matches Collection)
## Match Conversations [/api/v1/conversations]
### Create Conversation [POST]
+ Request (application/json)
+ Headers
access-token: Aq0GCbYKWFA0oAbcvRzP9g
client: 0WPgnm5Ns79vEqh1O81Akg
uid: test@test.com
token-type: Bearer
+ Body
{
"conversation":
{
"match_id": 1
}
}
+ Response 200 (application/json)
+ Attributes
+ conversation (Conversation, required)
### Get Conversations [GET]
+ Request (application/json)
+ Headers
access-token: Aq0GCbYKWFA0oAbcvRzP9g
client: 0WPgnm5Ns79vEqh1O81Akg
uid: test@test.com
token-type: Bearer
+ Response 200 (application/json)
+ Attributes
+ conversations (Conversations Collection)
### Messages Collection [/api/v1/conversations/{id}/messages]
## Get Messages [GET]
+ Request (application/json)
+ Headers
access-token: Aq0GCbYKWFA0oAbcvRzP9g
client: 0WPgnm5Ns79vEqh1O81Akg
uid: test@test.com
token-type: Bearer
+ Response 200 (application/json)
+ Attributes
+ messages (Messages Collection)
# Data Structures
## User Edition (object)
+ email: test@test.com (string)
+ name: Test (string)
+ gender: female (string)
+ password: password (string)
+ password_confirmation: password (string)
## User Update Edition (object)
+ email: test@test.com (string)
+ name: Test (string)
+ gender: female (string)
+ avatar (Avatar)
+ push_token (array[string])
## User Response (object)
+ id: 1 (number)
+ provider: email (string)
+ uid: test@test.com (string)
+ name: test (string)
+ email: test@test.com (string)
+ gender: male (string)
+ created_at: 2018-11-02T17:54:14.451Z (string)
+ updated_at: 2018-11-02T17:54:14.576Z (string)
+ avatar (Avatar)
+ push_token (array[string])
## User Facebook Response (object)
+ id: 1 (number)
+ provider: facebook (string)
+ uid: 987654321 (string)
+ name: test (string)
+ email: test@test.com (string)
## Avatar (object)
+ url: http://example.com (string)
+ thumb
+ url: http://example.com (string)
+ normal
+ url: http://example.com (string)
## Topics Collection (object)
+ topics (array[Topic], required)
## Topic (object)
+ id: 1 (number)
+ label: Football (string)
## Spots Collection (object)
+ spots (array[Spot], required)
## Spot (object)
+ id: 1 (number)
+ title: spot (string)
+ latitude: 34.907604 (number)
+ longitude: 56.201101 (number)
+ radius: 500 (number)
+ topic_id: 1 (number)
## Matches Collection (object)
+ matches (array[Match], required)
## Match (object)
+ id: 1 (number)
+ first_user_id: 1 (number)
+ second_user_id: 2 (number)
## Min Details Matches Collection (object)
+ matches (array[Min Details Match], required)
## Min Details Match (object)
+ id: 1 (number)
+ matched_user_id: 1 (number)
## Conversations Collection (object)
+ conversations (array[Conversation], required)
## Conversation (object)
+ id: 1 (number)
+ match_id: 1 (number)
+ unread_messages: 0 (number)
+ last_message: null (string)
## Messages Collection (object)
+ messages (array[Message], required)
## Message (object)
+ id: 1 (number)
+ content: Message (string)
+ created_at: 2018-09-25T18:28:25.834Z (string)
+ sender_id: 1 (number)