forked from osu-mist/catalog-api-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcatalogapi.yaml
546 lines (507 loc) · 13.6 KB
/
catalogapi.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
# Example YAML to get you started quickly.
# Be aware that YAML has indentation based scoping.
# Code completion support is available so start typing for available options.
swagger: '2.0'
# This is your document metadata
info:
version: "0.0.1"
title: Catalog API Test
# Describe your paths here
paths:
# This is a path endpoint. Change it.
/courses:
# This is a HTTP operation
get:
tags:
- courses
# Describe this verb here. Note: you can use markdown
description: "Gets all `Course` objects. Can be filtered by parameters."
operationId: getCourses
# This is array of GET operation parameters:
produces:
- application/json
parameters:
- in: query
name: coursename
description: "Course name to filter list of courses by"
required: false
type: string
- in: query
name: location
description: "Location name to filter list of courses by"
required: false
type: string
- in: query
name: timeStart
description: "Specific course start time to filter list of courses by"
required: false
type: string
- in: query
name: timeEnd
description: "Specific course end time to filter list of courses by"
required: false
type: string
- in: query
name: timeStartAfter
description: "Filter list by Classes that start after this time"
required: false
type: string
- in: query
name: timeEndBefore
description: "Filter list by Classes that end before this time"
required: false
type: string
# An example parameter that is in query and is required
# Expected responses for this operation:
responses:
# Response code
"200":
description: "Successful response"
# A schema describing your response object.
# Use JSON Schema format
schema:
$ref: "#/definitions/Courses"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
post:
tags:
- courses
summary: "Post a course representation to be appended"
operationId: postCourse
consumes:
- application/json
parameters:
- name: body
in: body
description: "Course object that needs to be added to the catalog"
required: true
schema:
$ref: "#/definitions/Course"
responses:
"200":
description: "Successful responses"
"201":
description: "Resource created"
"202":
description: "Representation accepted"
"401":
description: "User is unauthorized to do this action"
"422":
description: "Invalid Data"
schema:
$ref: "#/definitions/Errors"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
/courses/{crn}:
get:
tags:
- courses
description: "Finds course by CRN"
operationId: getCourseByCRN
produces:
- application/json
parameters:
- name: crn
in: path
description: "CRN ID of course to be fetched"
required: true
type: integer
format: int64
responses:
"200":
description: "Successful response"
schema:
$ref: "#/definitions/Courses"
"404":
description: "Resource not found"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
put:
tags:
- courses
summary: "Puts a course resource to be updated or created."
operationId: updateCourseByCRN
consumes:
- application/json
parameters:
- name: crn
in: path
description: "Resource CRN ID to be updated"
required: true
type: integer
format: int64
- name: body
in: body
description: "Course object that needs to be added to the catalog"
required: true
schema:
$ref: "#/definitions/Course"
responses:
"200":
description: "Successful response"
"202":
description: "Representation accepted"
"401":
description: "User is unauthorized to do this action"
"422":
description: "Invalid Data"
schema:
$ref: "#/definitions/Errors"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
delete:
tags:
- courses
summary: "Deletes a course resource"
operationId: deleteCourseByCRN
parameters:
- in: path
name: crn
description: "Course CRN ID to be deleted"
required: true
type: integer
format: int64
responses:
"200":
description: "Successful response"
"202":
description: "Delete request accepted"
"401":
description: "User isn't authorized to do this action"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
/courses/name/{coursename}:
get:
tags:
- courses
summary: "Gets all courses by coursename"
operationId: findCourseByName
produces:
- application/json
parameters:
- in: path
name: coursename
description: "Course name of course to be searched by"
required: true
type: string
- in: query
name: instructorid
description: "InstructorID to filter by"
required: false
type: integer
format: int64
- in: query
name: instructorName
description: "Instructor name to filter by"
required: false
type: string
responses:
"200":
description: "Successful response"
schema:
$ref: "#/definitions/Courses"
"404":
description: "Invalid course name"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
/courses/location:
get:
tags:
- courses
description: "Get all course locations"
operationId: getCourseLocations
produces:
- application/json
responses:
"200":
description: "Successful response"
schema:
$ref: "#/definitions/Locations"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
/courses/location/{location}:
get:
tags:
- courses
summary: "Gets all courses at specified location"
operationId: findCourseByLocation
consumes:
- application/json
parameters:
- in: path
name: location
description: "Location of course to be searched by"
required: true
type: string
- in: query
name: day
description: "Day to filter by"
required: false
type: string
- in: query
name: time
description: "Time to filter by"
required: false
type: string
responses:
"200":
description: "Successful response"
schema:
$ref: "#/definitions/Course"
"404":
description: "Invalid Location"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
/courses/taughtByInstructor/{instructorID}:
get:
tags:
- courses
operationId: findCourseByInstructorID
summary: "Gets all courses by Instructor ID"
produces:
- application/json
parameters:
- in: path
name: instructorID
description: "instructorid to search by"
required: true
type: integer
format: int64
responses:
"200":
description: "Successful response"
schema:
$ref: "#/definitions/Course"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
/instructors:
get:
tags:
- instructors
description: |
Gets all `Instructor` object
operationId: getInstructors
produces:
- application/json
parameters:
- in: query
name: first_initial
description: "First initial to filter list by"
required: false
type: string
- in: query
name: last_name
description: "Last name to filter list by"
required: false
type: string
- in: query
name: number_of_courses
description: "Filter instructors by number of courses taught"
required: false
type: integer
format: int64
responses:
"200":
description: Successful response
schema:
$ref: "#/definitions/Instructors"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
post:
tags:
- instructors
description: "Post an Instructor representation object to the resource"
operationId: postInstructor
consumes:
- application/json
parameters:
- in: body
name: instructor_rep
description: "instructor_representation to be posted"
required: true
schema:
$ref: "#/definitions/Instructor"
responses:
"200":
description: "Successful responses"
"201":
description: "Resource created"
"202":
description: "Representation accepted"
"401":
description: "User isn't authorized to do this action"
"422":
description: "Invalid Data"
schema:
$ref: "#/definitions/Errors"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
/instructors/{instructorID}:
get:
tags:
- instructors
description: "Gets instructor by id"
operationId: getInstructorByID
produces:
- application/json
parameters:
- name: instructorID
in: path
description: "instructorID to search by"
required: true
type: integer
format: int64
responses:
"200":
description: "Successful response"
"404":
description: "Resource not found"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
put:
tags:
- instructors
description: "Puts to an instructor resource to be updated or created"
operationId: updateInstructorByID
consumes:
- application/json
parameters:
- name: instructorID
in: path
description: "instructorID to put definitions"
required: true
type: integer
format: int64
responses:
"200":
description: "Successful response"
"201":
description: "Resource created"
"202":
description: "Representation accepted"
"401":
description: "User isn't authorized to do this action"
"422":
description: "Invalid representation data"
schema:
$ref: "#/definitions/Errors"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
delete:
tags:
- instructors
description: "Deletes an instructor resource"
operationId: deleteInstructorByID
parameters:
- name: instructorID
in: path
description: "instructorID to be deleted"
required: true
type: integer
format: int64
responses:
"200":
description: "Successful response"
"202":
description: "Request accepted"
"401":
description: "User isn't authorized to do this action"
"500":
description: "Internal Server Error"
security:
- catalog_api_key: []
securityDefinitions:
catalog_api_key:
type: apiKey
name: catalog_api_key
in: query
definitions:
Instructor:
required:
# instructor id is an internal identifier so user shouldn't be required to put that
#- instructor_id
- instructor_name
properties:
instructor_id:
type: integer
format: int64
instructor_name:
type: string
rate_my_professor_link:
type: string
Instructors:
title: ArrayOfInstructors
type: array
items:
$ref: "#/definitions/Instructor"
Course:
required:
- CRN
- course_name
- instructor_name
#- instructor_id INTERNAL ID
- day
- time
- location
properties:
CRN:
type: integer
format: int64
course_name:
type: string
instructor_name:
type: string
instructor_id:
type: integer
format: int64
day:
type: string
time:
type: string
location:
type: string
Courses:
title: ArrayOfCourses
type: array
items:
$ref: "#/definitions/Course"
Location:
type: string
Locations:
title: ArrayOfLocations
type: array
items:
$ref: "#/definitions/Location"
Error:
type: string
Errors:
title: ArrayOfErrors
type: array
items:
$ref: "#/definitions/Error"