-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapidoc.raml
446 lines (439 loc) · 11.4 KB
/
apidoc.raml
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
#%RAML 1.0
---
title: ditup.org REST
baseUri: https://api.ditup.org/{version}
version: v1
mediaType: application/vnd.api+json
types:
User:
properties:
type:
enum: [users]
id:
type: string
attributes:
properties:
givenName:
familyName:
description:
location:
email:
Tag:
properties:
type:
enum: [tags]
id:
type: string
/users:
get:
description: |
The following data can be received:
- new users: `?sort=-created&page[offset]=0&page[limit]=5`
- users with my tags `?filter[byMyTags]`
- users by tags `?filter[tag]=tag1,tag2,tag3` TODO rename
- new users with my tags: `?sort=-created&filter[withMyTags]=2&page[offset]=5&page[limit]=3`
- users within a rectangle: `?filter[location]=-1.0,-1.0,1.0,1.0`
queryParameters:
filter?:
properties:
tag?:
type: string
description: a comma separated list of tags to search by
byMyTags?:
type: nil
description: perform a search by tags which i (logged user) have
withMyTags?:
type: integer
description: Amount of tags which found users should have in common with me. Used in connection with sort=-created
location?:
type: string
description: A rectangle to search within - `southWestLatitude,southWestLongitude,northEastLatitude,northEastLongitude`.
sort?:
description: if sort=-created is specified, new users will be returned
enum:
- '-created'
page?:
description: support for pagination
properties:
offset:
type: integer
description: offset of the documents to return (which is the first document to return?)
limit:
type: integer
description: amount of documents to return
responses:
200:
400:
post:
description: Create a new user with unverified email. Verification message will be sent to the provided email.
body:
example:
data:
type: users
attributes:
username: user1
email: [email protected]
password: correcthorsebatterystaple
responses:
201:
description: Success.
body:
example:
data:
type: users
id: user1
attributes:
username: user1
givenName:
familyName:
description:
location:
400:
description: Validation error.
409:
description: Conflict. Username must be unique.
/{username}:
get:
responses:
200:
# examples:
# - notLogged:
# data:
# type: users
# id: user1
# - logged:
# data:
# type: users
# id: user1
# attributes:
# givenName: name
# familyName:
# description: this is a description
# location:
# - loggedAsSelf:
# data:
# type: users
# id: user1
# attributes: # TODO
404:
description: User doesn't exist.
patch:
description: Edit user profile (givenName, familyName, description, location).
responses:
200:
403:
400:
/avatar:
get:
description: Get an avatar image of an user. Specifying size is supported.
queryParameters:
filter?:
properties:
size:
description: Return avatar of a specified size.
enum:
- 16
- 32
- 64
- 128
- 256
- 512
responses:
200:
body:
image/svg+xml:
description: Default Identicon.js image.
image/jpeg:
description: Image provided by user.
403:
404:
patch:
description: Upload avatar image. Maximum size is 2MB.
body:
multipart/form-data:
description: |
Supported image types:
- jpeg
- png
responses:
200:
400:
403:
# TODO: delete
/tags:
get:
description: Get a list of user's tags (with story and relevance).
responses:
200:
# TODO 403:
# TODO 404:
post:
description: Add a tag to self and specify story and relevance.
responses:
201:
400:
403:
404:
409:
/{tagname}:
get:
description: Show a tag and user's story and relevance.
responses:
200:
# TODO!!! 403, 404
patch:
description: Update user's story and/or relevance to a tag.
responses:
200:
400:
403:
404:
delete:
description: Remove a tag from a user.
responses:
204:
403:
404:
/auth:
/token:
get:
description: Send Basic auth header and receive JWT token.
responses:
200:
body:
example:
meta:
token: aaa.bbb.ccc
401:
/exp:
get:
description: Get time till a provided token's expiration [seconds].
responses:
200:
body:
example:
meta:
exp: 3600
403:
# TODO JWT Token
# send Basic auth header and receive JWT token
# check validity of a given JWT token
# remove basic auth
/account:
patch:
description: |
The following actions are supported:
- send email with code for resetting forgotten password
- reset forgotten password with reset code
- update unverified email and send verification link
- verify email
- change password
queryParameters:
reset-password?:
type: nil
description: Send email with code for resetting forgotten password
/contacts:
get:
description: |
Show trust and reference which user gave or received.
Don't show unconfirmed contacts to 3rd users.
Don't show trust and reference to user who received contact request and didn't confirm, yet.
queryParameters:
filter:
properties:
from?:
type: string
description: Read contacts given by the specified user.
to?:
type: string
description: Read contacts given to the specified user.
post:
description: Create a contact request.
responses:
201:
400:
403:
404:
409:
/{from}/{to}:
get:
description: |
Show a contact between two users including reference and trust given by `:from` to `:to`
- the requester should see unconfirmed contact including message
- the requested should see only the message of the unconfirmed contact
- every other logged user can see only confirmed contacts (trust and reference)
patch:
description: |
The following actions are supported:
- confirm a contact request
- update a contact from self
responses:
200:
400:
403:
404:
delete:
description: Delete a contact.
/messages:
post:
description: Create a new message to another user.
get:
description: |
The following information can be retrieved:
- messages with another user
- threads
- amount of threads with unread messages
queryParameters:
filter:
properties:
count:
description: Show amount of unread threads.
type: nil
threads:
description: Show last messages of my threads sorted by time.
type: nil
with:
type: string
description: Show messages with the given user from newest to oldest.
responses:
200:
403:
404:
# TODO 400
/{id}:
patch:
description: Set `read` to `true` on the message and all the previous unread messages.
responses:
200:
403:
/tags:
get:
description: |
The following data can be received
- tags with names similar to a given string (similarity = one of the words in tagname starts with the given string) (`?filter[tagname][like]=fraction-of-tag-name`)
- tags related to my tags `?filter[relatedToMyTags]`
- tags related to given tags `?filter[relatedToTags]=tag1,tag2,tag3`
- random tags `?filter[random]`
- popular tags by amount of uses `?sort=-popularityByUses`
TODO: new tags (which have some uses)
queryParameters:
filter?:
properties:
tagname:
properties:
like:
type: string
relatedToMyTags:
type: nil
relatedToTags:
description: a comma separated list of tags to search from
type: string
random:
type: nil
sort?:
description: if sort=-popularityByUses is specified, popular tags will be returned
enum:
- '-popularityByUses'
responses:
200:
400:
403:
post:
description: Create a new tag.
responses:
201:
400:
403:
409:
/{tagname}:
get:
description: Read a tag.
responses:
200:
404:
/ideas:
post:
description: Create a new idea.
responses:
201:
400:
403:
get:
description: |
Get a list of ideas
- ideas with my tags: `?filter[withMyTags]`
- ideas with provided tags: `?filter[withTags]=tagname0,tagname1,tagname2`
- new ideas: `?sort=-created`
- ideas with provided creators: `?filter[creators]=username0,username1,username2`
- ideas commented by provided users: `?filter[commentedBy]=username0,username1,username2`
- highly voted ideas with minimum amount of votes parameter: `?filter[highlyVoted]=bottomValueLimit`
- trending ideas: `?filter[trending]`
/{id}:
get:
description: Read an idea by id.
responses:
200:
400:
403:
404:
patch:
description: |
Update an idea (title, detail).
Currently only creator is authorized to do that.
response:
200:
400:
403:
404:
/tags:
post:
description: Add tag to idea.
responses:
201:
400:
403:
404:
409:
get:
description: Get tags of idea.
responses:
200:
400:
403:
404:
/{tagname}:
delete:
description: Remove tag from idea.
responses:
204:
400:
403:
404:
/comments:
post:
description: Create a comment for an idea.
responses:
201:
400:
403:
404:
get:
/votes:
post:
description: Vote for an idea.
responses:
201:
400:
403:
404:
/comments:
/{id}:
patch:
delete:
/reactions:
post:
get:
/reactions:
/{id}:
patch:
delete: