This repository has been archived by the owner on Nov 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
apiary.apib
663 lines (545 loc) · 20.2 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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# oms-core-elixir
Oms-Core-Elixir is a drop-in replacement for oms-core which still doesn't work...
Requests might have permission requirements which you can read in [the wiki](https://oms-project.atlassian.net/wiki/spaces/OMSCORE/pages/169279489/oms-core-elixir).
Permissions are calculated on the fly and depending on the body context they are requested in.
As usual in oms, the access token has to be sent in the x-auth-token header field.
All routes are to be prefixed by /api
# Group Permission-related requests
Permissions are part of a simple CRUD API.
## Permissions [/permissions]
### List All Permissions [GET]
Returns all permissions known to the system.
Requires view:permission
+ Response 200 (application/json)
{
"success": true,
"data": [
{
"scope": "global",
"object": "permission",
"id": 1,
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
},
{
"scope": "global",
"object": "permission",
"id": 2,
"description": "Create new permission objects which haven't been in the system yet, usually only good for microservices",
"always_assigned": false,
"action": "create"
}
]
}
### Create a new permission [POST]
Creates a new permission, usually only done by microservice which want to use the core permission system.
Requires create:permission
+ Request (application/json)
{
"permission": {
"scope": "global",
"object": "permissions",
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
}
}
+ Response 200 (application/json)
{
"success": true,
"data": {
"scope": "global",
"object": "permission",
"id": 5,
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
}
}
## My Permissions [/my_permissions]
### Get my global permissions [GET]
Returns all permissions the user has globally. If you want to know permissions in a body or for a circle, use GET /bodies/:body_id/my_permissions or GET /circles/:circle_id/my_permissions
+ Response 200 (application/json)
{
"success": true,
"data": [
{
"scope": "global",
"object": "permission",
"id": 1,
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
},
{
"scope": "global",
"object": "permission",
"id": 2,
"description": "Create new permission objects which haven't been in the system yet, usually only good for microservices",
"always_assigned": false,
"action": "create"
}
]
}
## Single Permission [/permissions/:permission_id]
### Get a single permission [GET]
Gets details about a single permission.
Requires view:permission
+ Response 200 (application/json)
{
"success": true,
"data": {
"scope": "global",
"object": "permission",
"id": 1,
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
}
}
### Update a single permission [PUT]
Updates the fields of a single permission.
Requires update:permission
+ Request (application/json)
{
"permission": {
"scope": "global",
"object": "blabbery",
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
}
}
+ Response 200 (application/jsoh)
{
"success": true,
"data": {
"scope": "global",
"object": "blabbery",
"id": 5,
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
}
}
### Delete a single permission [DELETE]
Deletes a permission.
Requires delete:permission
+ Response 204
# Group Free Circle-related requests
Free circles also more or less have a CRUD api, but also allow for members management
## All Circles [/circles]
### Get all free circles [GET]
Lists all circles that are not bound to a body. Prefetches nothing, only the bare circle data and ids of parent circle and body.
To view bound circles, use GET /bodies/:body_id/circles
Requires view:circle
+ Response 200 (application/json)
{
"success": true,
"data": [
{
"permissions": null,
"parent_circle_id": null,
"parent_circle": null,
"name": "some name",
"joinable": true,
"id": 2,
"description": "some description",
"child_circles": null,
"body_id": null,
"body": null
}
]
}
### Create a circle [POST]
Creates a new free circle. The user who creates it will automatically be assigned as circle_admin in that circle.
Requires create:free_circle
+ Request (application/json)
{
"circle": {
"name": "IT-interested people",
"description": "In this circle all people interested in IT are gathered",
"joinable": true
}
}
+ Response 201 (application/json)
{
"success": true,
"data": {
"parent_circle_id": null,
"parent_circle": null,
"name": "IT-interested people",
"joinable": true,
"id": 2,
"description": "In this circle all people interested in IT are gathered",
"body_id": null,
"body": null
}
}
## Single Circle [/circle/:circle_id]
### Get details to a single circle [GET]
Returns details such as a prefetched parent circle, body, child circles and permissions. The permissions are only which are assigned directly to the circle, not the inherited ones from parent circles.
Requires view:circle
+ Response 200 (application/json)
{
"success": true,
"data": {
"permissions": [],
"parent_circle_id": 2,
"parent_circle": {
"permissions": null,
"parent_circle_id": null,
"parent_circle": null,
"name": "some name",
"joinable": true,
"id": 2,
"description": "some description",
"child_circles": null,
"body_id": null,
"body": null
},
"name": "some name",
"joinable": true,
"id": 1,
"description": "some description",
"child_circles": [],
"body_id": 1,
"body": {
"phone": "some phone",
"name": "some name",
"legacy_key": "some legacy_key",
"id": 1,
"email": "some email",
"description": "some description",
"address": "some address"
}
}
}
### Update a single circle [POST]
Update details of a single circle, meaning the joinable status in case that doesn't inflict the joinable consistency upwards, the name and the description.
The body_id can not be edited, for this delete the circle and recreate it in the correct body.
The parent_circle_id is also not updateable through this request, for updating the parent circle please use PUT /circles/:circle_id/parent.
Requires update:circle
+ Request (application/json)
{
"circle": {
"name": "IT-interested people",
"description": "In this circle all people interested in IT are gathered",
"joinable": true
}
}
+ Response 200 (application/json)
{
"success": true,
"data": {
"permissions": [],
"parent_circle_id": 2,
"parent_circle": {
"permissions": null,
"parent_circle_id": null,
"parent_circle": null,
"name": "some name",
"joinable": true,
"id": 2,
"description": "some description",
"child_circles": null,
"body_id": null,
"body": null
},
"name": "IT-interested people",
"joinable": true,
"id": 1,
"description": "In this circle all people interested in IT are gathered",
"child_circles": [],
"body_id": 1,
"body": {
"phone": "some phone",
"name": "some name",
"legacy_key": "some legacy_key",
"id": 1,
"email": "some email",
"description": "some description",
"address": "some address"
}
}
}
### Delete a single circle [DELETE]
Deletes a circle and all its circle memberships and permission attachments.
Requires delete:circle
+ Response 204
## Put the parent circle [/circles/:circle_id/parent]
### Put the parent circle [PUT]
Puts a circle as a parent circle. This request can be called with two permissions
With put_parent:circle the user can put whatever circle he wants as a parent to this one
With put_parent:bound_circle the user can only put parents that are in the same body as the edited circle.
+ Request (application/json)
{
"parent_circle_id": 2
}
+ Response 200 (application/json)
{
"success": true,
"data": {
"permissions": [],
"parent_circle_id": 2,
"parent_circle": {
"permissions": null,
"parent_circle_id": null,
"parent_circle": null,
"name": "some name",
"joinable": true,
"id": 2,
"description": "some description",
"child_circles": null,
"body_id": null,
"body": null
},
"name": "IT-interested people",
"joinable": true,
"id": 1,
"description": "In this circle all people interested in IT are gathered",
"child_circles": [],
"body_id": 1,
"body": null
}
}
## Circle members [/circles/:circle_id/members]
### Get circle members [GET]
Returns all circle_memberships in the circle.
Requires view_members:circle
+ Response 200 (application/json)
{
"success": true,
"data": [
{
"position": null,
"member_id": 1,
"member": {
"user_id": 1,
"seo_url": "31138974",
"phone": "+1212345678",
"last_name": "some last_name",
"id": 1,
"gender": "some gender",
"first_name": "some first_name",
"date_of_birth": "2010-04-17",
"address": "some address",
"about_me": "some about_me"
},
"id": 1,
"circle_id": 1,
"circle_admin": false,
"circle": null
}
]
}
### Join a circle [POST]
Joins a circle in case it is joinable.
You don't need to post any data as you can not join another member at the moment.
In case you want to join a bound circle you have to be member of the body
Requires join:circle
+ Response 200 (application/json)
{
"success": true,
"data": "You successfully joined the circle"
}
## Single circle membership [/circles/:circle_id/members/:membership_id]
The membership id is the id of the circle membership, not the id of the member. In GET /circles/:circle_id/members it's on the first level.
### Update single circle membership [PUT]
Set the position and the circle_admin position of a member.
Requires update_members:circle
+ Request (application/json)
{
"circle_membership": {
"position": "Some really nice position",
"circle_admin": true
}
}
+ Response 200 (application/jsoh)
{
"success": true,
"data": {
"position": "Some really nice position",
"member_id": 1,
"member": null,
"id": 2,
"circle_id": 2,
"circle_admin": true,
"circle": null
}
}
### Delete single circle membership [DELETE]
Deletes a membership and thus excludes the member from the circle.
Requires delete_members:circle
+ Response 204
## Get my permissions [/circles/:circle_id/my_permissions]
### Get my permissions [GET]
Returns all permissions the user has in that circle. This also includes global permissions and permissions obtained through a body in case the circle is bound.
+ Response 200 (application/json)
{
"success": true,
"data": [
{
"scope": "global",
"object": "permission",
"id": 1,
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
},
{
"scope": "global",
"object": "permission",
"id": 2,
"description": "Create new permission objects which haven't been in the system yet, usually only good for microservices",
"always_assigned": false,
"action": "create"
}
]
}
## Circle permissions [/circles/:cirlce_id/permissions]
### Get all circle permissions [GET]
Gets all permissions that are directly or indirectly assigned to the circle. If you want to know only directly assigned permissions, use GET /circles/:circle_id
+ Response 200 (application/json)
{
"success": true,
"data": [
{
"scope": "global",
"object": "permission",
"id": 1,
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
},
{
"scope": "global",
"object": "permission",
"id": 2,
"description": "Create new permission objects which haven't been in the system yet, usually only good for microservices",
"always_assigned": false,
"action": "create"
}
]
}
### Put circle permissions [PUT]
Puts the permissions that are directly attached to a circle.
Requires put_permissions:circle
+ Request (application/json)
{
"permissions": [
{"id": 1},
{"id": 2}
]
}
+ Response 200 (application/json)
{
"success": true,
"data": {
"permissions": [
{
"scope": "global",
"object": "permission",
"id": 1,
"description": "View permissions available in the system",
"always_assigned": true,
"action": "view"
},
{
"scope": "global",
"object": "permission",
"id": 2,
"description": "Create new permission objects which haven't been in the system yet, usually only good for microservices",
"always_assigned": false,
"action": "create"
}
],
"parent_circle_id": 2,
"parent_circle": {
"permissions": null,
"parent_circle_id": null,
"parent_circle": null,
"name": "some name",
"joinable": true,
"id": 2,
"description": "some description",
"child_circles": null,
"body_id": null,
"body": null
},
"name": "IT-interested people",
"joinable": true,
"id": 1,
"description": "In this circle all people interested in IT are gathered",
"child_circles": [],
"body_id": 1,
"body": {
"phone": "some phone",
"name": "some name",
"legacy_key": "some legacy_key",
"id": 1,
"email": "some email",
"description": "some description",
"address": "some address"
}
}
}
## Bound circles [/bodies/:body_id/circles]
### Get all bound circles [GET]
Returns all bound circles in the body.
+ Response 200 (application/json)
{
"success": true,
"data": [
{
"permissions": null,
"parent_circle_id": 2,
"parent_circle": null,
"name": "IT-interested people",
"joinable": true,
"id": 1,
"description": "In this circle all people interested in IT are gathered",
"child_circles": null,
"body_id": 1,
"body": null
}
]
}
### Create a bound circle [POST]
Creates a circle bound to the body. You need to be member of the body to execute this.
Requires create:bound_circle
+ Request (application/json)
{
"circle": {
"name": "outlaws",
"description": "really mean people",
"joinable": false,
}
}
+ Response 200 (application/json)
{
"success": true,
"data": {
"permissions": null,
"parent_circle_id": null,
"parent_circle": null,
"name": "outlaws",
"joinable": false,
"id": 3,
"description": "really mean people",
"child_circles": null,
"body_id": 1,
"body": {
"phone": "some phone",
"name": "some name",
"legacy_key": "some legacy_key",
"id": 1,
"email": "some email",
"description": "some description",
"address": "some address"
}
}
}