-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
563 lines (558 loc) · 15.1 KB
/
swagger.yaml
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
swagger: '2.0'
info:
title: BirdFeed
description: Provide for and analyze metrics on the quality of spoken English.
version: 1.0.0
contact:
name: David Stancu, Paulina Levit
email: dstancu@nyu.edu
license:
name: MIT
url: https://github.com/mach-kernel/birdfeed/blob/master/LICENSE
host: birdfeed.herokuapp.com
schemes:
- https
securityDefinitions:
birdcage:
type: oauth2
authorizationUrl: https://birdfeed.herokuapp.com/v1/auth
flow: implicit
scopes:
client: Allows a BirdFeed consumer to register participants
participant: Allows a Participant resource to record scores from a client, retrieve samples and experiments
user: Allows non-participant users to modify samples and experiments
administrator: Allows unrestricted access to all resources
basePath: /v1
produces:
- application/json
paths:
/sample:
get:
summary: Retrieve samples
description: |
Retrieve a list of audio sample resources. By default, a limit of 10 samples are returned. These will be the most recent samples created.
parameters:
- name: limit
in: query
description: Number of audio samples to return
type: integer
tags:
- Samples
responses:
200:
description: An array of samples
schema:
type: array
items:
$ref: '#/definitions/Sample'
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- participant
- user
- administrator
/sample/set:
post:
summary: Retrieve a set of audio samples
description: |
Retrieve a set of audio sample resources by ID. If a resource cannot be found, that resource will not be returned. Upon passing an empty array or an array with all invalid IDs, an empty set will be returned.
parameters:
- name: ids
in: body
description: Array of audio sample IDs
schema:
type: array
items:
type: string
required: true
tags:
- Samples
responses:
200:
description: An array of the desired samples.
schema:
type: array
items:
$ref: '#/definitions/Sample'
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- participant
- user
- administrator
/sample/search:
get:
summary: Retrieve audio sample(s) by specified criterion.
description: |
Retrieve one or many audio samples by the specified search criterion. Only one criteria should be specified for a search. All matching resources will be returned, in the case of no matching resources, an empty set will be returned.
parameters:
- name: name
in: query
description: The name of the audio sample file
type: string
- name: tags
in: query
description: Tags associated with sample file
type: array
items:
type: string
- name: date
in: query
description: Date when sample was created. Time will be used if provided.
type: string
format: date-time
tags:
- Samples
responses:
200:
description: An array of the desired samples.
schema:
type: array
items:
$ref: '#/definitions/Sample'
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- participant
- user
- administrator
/sample/{id}:
get:
summary: Audio samples
description: |
Retrieve an audio sample by its ID
parameters:
- name: id
in: path
description: ID of audio sample resource
required: true
type: integer
tags:
- Samples
responses:
200:
description: An audio sample resource
schema:
$ref: '#/definitions/Sample'
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- participant
- user
- administrator
post:
summary: Audio samples
description: |
Modify an audio sample by its ID. If a field is left empty, it will not be modified.
parameters:
- name: id
in: path
description: ID of audio sample resource
type: integer
required: true
- name: modify
in: body
description: Modified fields
schema:
type: object
properties:
name:
type: string
expected_score:
type: integer
s3_url:
type: string
tags:
type: array
items:
type: string
required: true
tags:
- Samples
responses:
200:
description: Modified Sample resource
schema:
$ref: '#/definitions/Sample'
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- user
- administrator
delete:
summary: Audio samples
description: |
Delete an audio sample by its ID
parameters:
- name: id
in: path
description: ID of audio sample resource
type: integer
required: true
tags:
- Samples
responses:
200:
description: Sample was successfully deleted
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- user
- administrator
/sample/create:
post:
summary: Create audio samples
description: |
Create an audio sample. Returns ID of newly created resource.
parameters:
- name: sample
in: body
description: The filename, AWS link for the location of the sound file, tags, and expected score (enter -1 for no expected score)
schema:
type: object
properties:
name:
type: string
s3_url:
type: string
expected_score:
type: integer
tags:
type: array
items:
type: string
required: true
tags:
- Samples
responses:
201:
description: The ID of the newly created Sample resource
schema:
type: string
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- user
- administrator
/experiment/{id}:
get:
summary: Retrieve experiment by ID
description: |
Retrieves an experiment resource by its ID
parameters:
- name: id
in: path
description: ID of experiment resource
type: string
required: true
tags:
- Experiments
responses:
200:
description: An experiment resource
schema:
$ref: '#/definitions/Experiment'
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- participant
- user
- administrator
post:
summary: Modify an experiment by ID.
description: |
Modify an experiment by its ID. If a field is left empty, it will not be modified.
parameters:
- name: id
in: path
description: ID of experiment resource
type: string
required: true
- name: modify
in: body
description: Modified fields
schema:
type: object
properties:
name:
type: string
expiry_date:
type: string
format: date-time
tags:
type: array
items:
type: string
required: true
tags:
- Experiments
responses:
200:
description: Modified experiment resource
schema:
$ref: '#/definitions/Experiment'
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- user
- administrator
delete:
summary: Delete an experiment by ID
description: |
Delete an experiment by its ID
parameters:
- name: id
in: path
description: ID of experiment resource
type: string
required: true
tags:
- Experiments
responses:
200:
description: Experiment was successfully deleted
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- user
- administrator
/experiment/create:
post:
summary: Create an experiment
description: |
Create an experiment. Returns the ID of the newly created experiment resource.
parameters:
- name: experiment
in: body
description: The name, tags, and sample IDs to create the Experiment resource
schema:
type: object
properties:
name:
type: string
tags:
type: array
items:
type: string
samples:
type: array
items:
type: string
required: true
tags:
- Experiments
responses:
201:
description: The ID of the newly created Experiment resource
schema:
type: string
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- user
- administrator
/scores/record:
post:
summary: Record a score
description: |
Record the score of an audio sample. Once a score is recorded it can neither be modified nor removed.
parameters:
- name: scores
in: body
description: An array of Score resources
schema:
type: array
items:
$ref: '#/definitions/Score'
required: true
tags:
- Scores
responses:
201:
description: The ID of the score recorded
schema:
type: string
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- participant
/participant/register:
post:
summary: Register a participant
description: |
Register a participant / new user from a client to the BirdFeed API.
parameters:
- name: participant
in: body
description: Data for new participant resource
schema:
type: object
properties:
username:
type: string
password:
type: string
required: true
tags:
- Participants
responses:
201:
description: The ID of the newly created Participant resource
schema:
type: string
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
security:
- birdcage:
- client
definitions:
Sample:
type: object
properties:
id:
type: string
description: 'Unique ID for each audio sample'
name:
type: string
description: 'Filename of audio sample'
s3_url:
type: string
description: 'AWS link to location of audio sample'
date_added:
type: string
format: date-time
description: 'Timestamp of when sample was added'
total_scores:
type: integer
description: 'Number of times that this sample has been graded in an experiment'
avg_score:
type: number
description: 'Average linguistic quality of audio sample'
expected_score:
type: integer
description: 'Expected linguistic quality score of audio sample'
tags:
type: array
items:
type: string
description: 'Tags describing audio sample'
maximum: 5
Experiment:
type: object
properties:
id:
type: string
description: 'Unique ID for each experiment'
name:
type: string
description: 'User-defined name for experiment'
maximum: 80
date_created:
type: string
format: date-time
description: 'Timestamp of when experiment was created'
expiry_date:
type: string
format: date-time
description: 'Expiry date of experiment'
tags:
type: array
items:
type: string
description: 'Tags describing the experiment'
samples:
type: array
items:
type: string
description: 'The audio samples used for scoring'
Score:
type: object
properties:
participant_id:
type: string
description: 'The ID of the participant'
sample_id:
type: string
description: 'The ID of the sample being scored'
experiment_id:
type: string
description: 'The ID of the experiment the score belongs to'
rating:
type: number
format: double
maximum: 1
minimum: 0
description: 'The rating of the sample, 1 indicating perfect English speech, 0 indicating indiscernable speech'
Participant:
type: object
properties:
id:
type: string
description: 'The unique ID of the participant'
username:
type: string
description: 'A unique user defined name'
salt:
type: string
description: 'A salt of the plaintext password'
date_created:
type: string
format: date-time
description: 'Timestamp of when participant was created'
quality:
type: number
format: double
description: 'The quality of the participants ratings'
Error:
type: object
properties:
id:
type: string
description: 'Unique ID for error message'
message:
type: string
description: 'Details about the error encountered'
path:
type: string
description: 'Request target at time of error'
request:
type: object
description: 'The body of the request, if present'