-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapiary.apib
More file actions
613 lines (479 loc) · 19.5 KB
/
apiary.apib
File metadata and controls
613 lines (479 loc) · 19.5 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
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
FORMAT: 1A
HOST: https://api.voisee.jp
# Voisee API
## Authentication
The API server implements the OAuth2 protocol with the following routes
```
GET /oauth/authorize/:code
GET /oauth/authorize
POST /oauth/authorize
PUT /oauth/authorize
DELETE /oauth/authorize
POST /oauth/token
POST /oauth/revoke
resources /oauth/applications
GET /oauth/authorized_applications
DELETE /oauth/authorized_applications/:id
GET /oauth/token/info
```
See [doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) gem documentation
for more information.
## Roles
There are three different roles:
* Store group
* Can own one/multiple applications
* Can manage own application
* Can manage all stores in a store group
* Store
* Owns and manage application
* Can belong to multiple store groups
* Can manage store page in store group application
* Can upgrade/downgrade store plan
## Media Types
When applicable, this API returns JSON encoded
objects or arrays.
A list action will always return a JSON array,
while a get action will always return a JSON object.
## Pagination
All endpoints returning list accept the following parameters:
* min_id (optional, integer) ... The minimum ID to return. Default: `null`
* max_id (optional, integer) ... The maximum ID to return. Default: `null`
* count (optional, integer) ... The number of items to return. Default: `20`
All paginated responses contain the `X-Total-Count` header.
## Error States
The common [HTTP Response Status Codes](https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md) are used.
## Payment
All payments will use [WebPay](https://webpay.jp/).
## Plugins
All requests under the `/p` namespace will be forwarded to the plugin API if they have sufficient permission.
# Group Store Group
A group of store representing either a mall, or a commercial district.
## Store group [/store_groups/{id}]
Requires Store group role.
### Get store group [GET]
Get information about the store group.
+ Response 200
+ Body
```json
{
"id": 1,
"name": "某商店街"
}
```
## Stores [/store_groups/{id}/stores]
### List stores [GET]
List all approved stores in the store group.
Requires Store group role.
+ Response 200
+ Body
```json
[
{
"id": 1,
"name": "Toranoko",
"approved": true,
"created_at": "2015-04-27T18:37:52+09:00",
"updated_at": "2015-04-27T18:42:52+09:00"
}
]
```
### Create store [POST]
Creates a store in the Store Group.
The store is not made public until the `stores/{id}/approve` API is called.
+ Request
+ Body
```json
{
"name": "Toranoko"
}
```
+ Response 201
[Store]
+ Body
```json
{
"id": 1,
"name": "Toranoko",
"approved": false,
"created_at": "2015-04-27T18:37:52+09:00",
"updated_at": "2015-04-27T18:42:52+09:00"
}
```
# Group Store
## Approve store [/stores/{id}/approve]
Requires Store group role.
### Approve store [POST]
+ Response 204
## Store [/stores/{id}]
### Get a store [GET]
Requires Store group role or store role with `id` matching current store.
+ Response 200
+ Body
```json
{
"id": 1,
"name": "Toranoko",
"approved": true,
"available_credit_card": false,
"plan": {
"id": 1,
"type": "standard"
},
"created_at": "2015-04-27T18:37:52+09:00",
"updated_at": "2015-04-27T18:42:52+09:00"
}
```
### Update a store [PUT]
Requires store role.
+ Request
+ Body
```json
{
"name": "toranoko"
}
```
+ Response 200
+ Body
```json
{
"id": 1,
"name": "toranoko",
"plan": {
"id": 1,
"type": "standard"
},
"created_at": "2015-04-27T18:37:52+09:00",
"updated_at": "2015-04-27T18:42:52+09:00"
}
```
## Store plan [/stores/{id}/plan]
### Update plan [PUT]
Updates the current pricing plan. Requires store role.
To upgrade to premium plan, credit card information is needed.
+ Request
+ Body
```json
{
"type": "premium"
}
```
+ Response 204
# Group Store application
## Application [/stores/{id}/application]
+ Model
+ Body
```json
{
"status": "published",
"version": "0.4.1",
"configuration": "{\"theme\": \"brown\", \"plugins\": [\"news\", \"coupons\"]}"
}
```
### Get application [GET]
Requires store permission. Get the store application
+ Response 200
[Application][]
### Update application [PUT]
Requires store permission. Creates or updates the store application.
+ Request
+ Body
```json
{
"configuration": "{\"theme\": \"brown\"}"
}
```
+ Response 200
[Application][]
# Group Plugins
Available plugins are:
## News
Sample news:
{
"id": "5541e298f27ae7da50d17816",
"title": "2月24日に、本マグロの解体ショーを行います!",
"body": "本マグロの解体ショーの魅力は、何といってもそのスケールの大きさ。 解体する本マグロの重量は、ほとんどが200kgを超えるもの。\n時には、300kgを超える巨大本マグロを解体することもあります。 \n海の中で時速約90kmのスピードで止まることなく泳ぎ続ける本マグロは、15~18年でこの大きさに成長。本マグロは、このクラスが最も美味しいとされています。\n是非お越しください!",
"publishAt": "2015-02-18T16:54:25.473Z",
"images": [{
"id": "5541e298f27ae7da50d17816",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}],
"applicationId": 14,
"commentsCount": 3,
"likesCount": 4,
"viewsCount": 18,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
## Voices
Sample voice:
{
"id": "5541e298f27ae7da50d17816",
"body": "2月24日に、本マグロの解体ショーを行います!",
"images": [{
"id": "5541e298f27ae7da50d17816",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}],
"author": {
"id": 8,
"displayName": "だにー",
"profileImage": {
"id": "5541e298f27ae7da50d17716",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
},
"applicationId": 14,
"commentsCount": 3,
"likesCount": 4,
"viewsCount": 18,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
## Coupons
Sample coupon:
{
"id": "5541e298f27ae7da50d17816",
"title": "★フードもドリンクも♪全メニュー10%OFF!★",
"conditions": "ご来店のさいにご提示ください。また、他のクーポンやサービスとの併用できません。",
"expiresAt": "2015-02-18T16:54:25.473Z",
"image": {
"id": "5541e298f27ae7da50d17816",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
},
"applicationId": 14,
"commentsCount": 3,
"likesCount": 4,
"viewsCount": 18,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
# Comments
Sample comment:
{
"id": "5541e298f27ae7da50d17816",
"body": "とてもいい意見だと思います。",
"applicationId": 14,
"author": {
"id": 8,
"displayName": "だにー",
"profileImage": {
"id": "5541e298f27ae7da50d17716",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
},
"item": {
"itemId": "4541e298f27ae7da50d17716",
"type": "news"
},
"likesCount": 4,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
## Plugin items collection [/p/{plugin}]
+ Parameters
+ plugin: news (enum[string], required) - The plugin to use
+ Members
+ news
+ voices
+ coupons
+ comments
### List items [GET]
List plugin items.
+ Response 200 (application/json)
+ Body
```json
[{
"id": "5541e298f27ae7da50d17816",
"title": "2月24日に、本マグロの解体ショーを行います!",
"body": "本マグロの解体ショーの魅力は、何といってもそのスケールの大きさ。 解体する本マグロの重量は、ほとんどが200kgを超えるもの。\n時には、300kgを超える巨大本マグロを解体することもあります。 \n海の中で時速約90kmのスピードで止まることなく泳ぎ続ける本マグロは、15~18年でこの大きさに成長。本マグロは、このクラスが最も美味しいとされています。\n是非お越しください!",
"images": [{
"id": "5541e298f27ae7da50d17816",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}],
"applicationId": 14,
"commentsCount": 3,
"likesCount": 4,
"viewsCount": 18,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"publishedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}]
```
### Post item [POST]
+ Request
+ Body
```json
{
"title": "2月24日に、本マグロの解体ショーを行います!",
"body": "本マグロの解体ショーの魅力は、何といってもそのスケールの大きさ。 解体する本マグロの重量は、ほとんどが200kgを超えるもの。\n時には、300kgを超える巨大本マグロを解体することもあります。 \n海の中で時速約90kmのスピードで止まることなく泳ぎ続ける本マグロは、15~18年でこの大きさに成長。本マグロは、このクラスが最も美味しいとされています。\n是非お越しください!",
"publishedAt": "2015-02-18T16:54:25.473Z",
"images": [
"5541e298f27ae7da50d17816",
"5541e298f27ae7da50d18817"
],
"applicationId": 14
}
```
+ Response 201 (application/json)
+ Body
```json
{
"id": "5541e298f27ae7da50d17816",
"title": "2月24日に、本マグロの解体ショーを行います!",
"body": "本マグロの解体ショーの魅力は、何といってもそのスケールの大きさ。 解体する本マグロの重量は、ほとんどが200kgを超えるもの。\n時には、300kgを超える巨大本マグロを解体することもあります。 \n海の中で時速約90kmのスピードで止まることなく泳ぎ続ける本マグロは、15~18年でこの大きさに成長。本マグロは、このクラスが最も美味しいとされています。\n是非お越しください!",
"images": [{
"id": "5541e298f27ae7da50d17816",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}],
"applicationId": 14,
"commentsCount": 0,
"likesCount": 0,
"viewsCount": 0,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"publishedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
```
## Plugin item resource [/v1/{plugin}/{id}]
+ Parameters
+ id: 5541e298f27ae7da50d17816 (string, required) - The id of the item
+ plugin: news (enum[string], required) - The plugin to use
+ Members
+ news
+ voices
+ coupons
+ comments
### Retrieve item [GET]
+ Response 200 (application/json)
+ Body
```json
{
"id": "5541e298f27ae7da50d17816",
"title": "2月24日に、本マグロの解体ショーを行います!",
"body": "本マグロの解体ショーの魅力は、何といってもそのスケールの大きさ。 解体する本マグロの重量は、ほとんどが200kgを超えるもの。\n時には、300kgを超える巨大本マグロを解体することもあります。 \n海の中で時速約90kmのスピードで止まることなく泳ぎ続ける本マグロは、15~18年でこの大きさに成長。本マグロは、このクラスが最も美味しいとされています。\n是非お越しください!",
"images": [{
"id": "5541e298f27ae7da50d17816",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}],
"applicationId": 14,
"commentsCount": 3,
"likesCount": 4,
"viewsCount": 18,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"publishedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
```
### Update item [PUT]
+ Request
+ Body
```json
{
"title": "2月24日に、本マグロの解体ショーを行います!",
"body": "本マグロの解体ショーの魅力は、何といってもそのスケールの大きさ。 解体する本マグロの重量は、ほとんどが200kgを超えるもの。\n時には、300kgを超える巨大本マグロを解体することもあります。 \n海の中で時速約90kmのスピードで止まることなく泳ぎ続ける本マグロは、15~18年でこの大きさに成長。本マグロは、このクラスが最も美味しいとされています。\n是非お越しください!",
"images": [
"5541e298f27ae7da50d17816",
"5541e298f27ae7da50d18817"
],
"applicationId": 14
}
```
+ Response 200 (application/json)
+ Body
```json
{
"id": "5541e298f27ae7da50d17816",
"title": "2月24日に、本マグロの解体ショーを行います!",
"body": "本マグロの解体ショーの魅力は、何といってもそのスケールの大きさ。 解体する本マグロの重量は、ほとんどが200kgを超えるもの。\n時には、300kgを超える巨大本マグロを解体することもあります。 \n海の中で時速約90kmのスピードで止まることなく泳ぎ続ける本マグロは、15~18年でこの大きさに成長。本マグロは、このクラスが最も美味しいとされています。\n是非お越しください!",
"images": [{
"id": "5541e298f27ae7da50d17816",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}],
"applicationId": 14,
"commentsCount": 0,
"likesCount": 0,
"viewsCount": 0,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"publishedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}
```
### Update item [DELETE]
+ Response 200 (application/json)
+ Body
```json
{
"id": "5541e298f27ae7da50d17816",
"title": "2月24日に、本マグロの解体ショーを行います!",
"body": "本マグロの解体ショーの魅力は、何といってもそのスケールの大きさ。 解体する本マグロの重量は、ほとんどが200kgを超えるもの。\n時には、300kgを超える巨大本マグロを解体することもあります。 \n海の中で時速約90kmのスピードで止まることなく泳ぎ続ける本マグロは、15~18年でこの大きさに成長。本マグロは、このクラスが最も美味しいとされています。\n是非お越しください!",
"images": [{
"id": "5541e298f27ae7da50d17816",
"url": "https://images.voisee.jp/uploads/image/file/15/v1424451244/sic8lrgd62agvpogjc4g.png",
"originalWidth": 800,
"originalHeight": 600,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": null
}],
"applicationId": 14,
"commentsCount": 0,
"likesCount": 0,
"viewsCount": 0,
"createdAt": "2015-02-18T16:54:25.473Z",
"updatedAt": "2015-02-18T16:54:25.473Z",
"publishedAt": "2015-02-18T16:54:25.473Z",
"deletedAt": "2015-02-18T16:54:25.473Z"
}
```