-
Notifications
You must be signed in to change notification settings - Fork 1
/
swagger.yaml
591 lines (590 loc) · 20 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
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
definitions:
models.Airline:
properties:
callsign:
example: SAF
type: string
country:
example: United States
type: string
iata:
example: SA
type: string
icao:
example: SAF
type: string
name:
example: SampleName
type: string
id:
example: 10
type: string
required:
- country
- icao
- name
- id
type: object
models.Airport:
properties:
id:
example: 1273
type: string
airportname:
example: SampleAirport
type: string
city:
example: SampleCity
type: string
country:
example: United Kingdom
type: string
faa:
example: SAA
type: string
geo:
$ref: '#/definitions/models.Geo'
icao:
example: SAAA
type: string
tz:
example: Europe/Paris
type: string
required:
- airportname
- city
- country
- faa
type: object
models.Destination:
properties:
destinationairport:
example: JFK
type: string
type: object
models.Geo:
properties:
alt:
example: 48.864716
type: number
lat:
example: 2.349014
type: number
lon:
example: 92
type: number
type: object
models.Route:
properties:
id:
example: 10000
type: string
airline:
example: AF
type: string
airlineid:
example: airline_10
type: string
destinationairport:
example: JFK
type: string
distance:
example: 4151.79
type: number
equipment:
example: CRJ
type: string
schedule:
items:
$ref: '#/definitions/models.Schedule'
type: array
sourceairport:
example: SFO
type: string
stops:
example: 0
type: integer
required:
- airline
- airline_id
- destinationairport
- sourceairport
type: object
models.Schedule:
properties:
day:
example: 1
type: integer
flight:
example: XYZ123
type: string
utc:
example: "14:30"
type: string
type: object
info:
contact: {}
description: |2-
This API provides operations for multiple collections in the database, including CRUD operations and query examples.
We have a visual representation of the API documentation using Swagger, which allows you to interact with the API's endpoints directly through the browser. It provides a clear view of the API, including endpoints, HTTP methods, request parameters, and response objects.
Click on an individual endpoint to expand it and see detailed information. This includes the endpoint's description, possible response status codes, and the request parameters it accepts.
Trying Out the API
You can try out an API by clicking on the "Try it out" button next to the endpoints.
- Parameters: If an endpoint requires parameters, Swagger UI provides input boxes for you to fill in. This could include path parameters, query strings, headers, or the body of a POST/PUT request.
- Execution: Once you've inputted all the necessary parameters, you can click the "Execute" button to make a live API call. Swagger UI will send the request to the API and display the response directly in the documentation. This includes the response code, response headers, and response body.
Models
<div style="float: left;">Swagger documents the structure of request and response bodies using models. These models define the expected data structure using JSON schema and are extremely helpful in understanding what data to send and expect.
For details on the API, please check the tutorial on the Couchbase Developer Portal: https://developer.couchbase.com/tutorial-quickstart-ottomanjs
title: Quickstart in Couchbase with Ottoman JS and Express
version: "1.0"
paths:
/api/v1/airline/{id}:
delete:
description: 'Delete Airline with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to delete a document with specified
ID.<br><br>Code: [`controllers/airlineController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airlineController.js)<br><br>Method: `deleteAirline`'
parameters:
- description: Airline ID like airline_10
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"204":
description: Airline deleted
"404":
description: Airline Document ID Not Found
"500":
description: Internal Server Error
summary: Delete Document
tags:
- Airline collection
get:
description: 'Get Airline with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to get a document with specified
ID.<br><br>Code: [`controllers/airlineController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airlineController.js)<br><br>Method: `getAirline`'
parameters:
- description: Airline ID like airline_10
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Airline'
"404":
description: Airline Document ID not found
"500":
description: Internal Server Error
summary: Get Airline Document
tags:
- Airline collection
/api/v1/airline/:
post:
description: 'Create Airline with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to create a new document with a
specified ID<br><br>Code: [`controllers/airlineController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airlineController.js)<br><br>Method:
`createAirline`'
parameters:
- description: Data to create a new document
in: body
name: data
required: true
schema:
$ref: '#/definitions/models.Airline'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/models.Airline'
"400":
description: Bad Request
"409":
description: Airline document already exists
"500":
description: Internal Server Error
summary: Insert Document
tags:
- Airline collection
put:
description: 'Update Airline with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to upsert a document with specified
ID.<br><br>Code: [`controllers/airlineController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airlineController.js)<br><br>Method: `updateAirline`'
parameters:
- description: Updates document
in: body
name: data
required: true
schema:
$ref: '#/definitions/models.Airline'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Airline'
"400":
description: Bad Request
"500":
description: Internal Server Error
summary: Update Document
tags:
- Airline collection
/api/v1/airline/list:
get:
description: 'Get list of Airlines. Optionally, you can filter the list by Country<br><br>This
provides an example of using SQL++ query in Couchbase using Ottoman to fetch a list of documents
matching the specified criteria.<br><br>Code: [`controllers/airlineController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airlineController.js)<br><br>Method:
`listAirlines`'
parameters:
- description: 'Filter by country<br>Example: France, United Kingdom, United
States'
in: query
name: country
type: string
- description: 'Number of airlines to return (page size).<br>Example: 10'
in: query
name: limit
type: integer
- description: 'Number of airlines to skip (for pagination).<br>Example: 0'
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/models.Airline'
type: array
"500":
description: Internal Server Error
summary: Get Airlines by Country
tags:
- Airline collection
/api/v1/airline/to-airport:
get:
description: 'Get Airlines flying to specified destination Airport<br><br>This
provides an example of using SQL++ query in Couchbase using Ottoman to fetch a list of documents
matching the specified criteria.<br><br>Code:[`controllers/airlineController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airlineController.js)<br><br>Method:
`getAirlinesToAirport`'
parameters:
- description: 'Destination airport<br>Example : SFO, JFK, LAX'
in: query
name: airport
required: true
type: string
- description: 'Number of airlines to return (page size)<br>Default value :
10'
in: query
name: limit
type: integer
- description: 'Number of airlines to skip (for pagination)<br>Default value
: 0'
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/models.Airline'
type: array
"500":
description: Internal Server Error
summary: Get Airlines Flying to Airport
tags:
- Airline collection
/api/v1/airport/{id}:
delete:
description: 'Delete Airport with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to create a new document with a
specified ID<br><br>Code: [`controllers/airportController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airportController.js)<br><br>Method:
`deleteAirport`'
parameters:
- description: Airport ID like airport_1273
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"204":
description: Airport deleted
"404":
description: Airport Document ID Not Found
"500":
description: Internal Server Error
summary: Deletes Airport Document
tags:
- Airport collection
get:
description: 'Get Airport with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to create a new document with a
specified ID<br><br>Code: [`controllers/airportController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airportController.js)<br><br>Method:
`getAirport`'
parameters:
- description: Airport ID like airport_1273
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Airport'
"404":
description: Airport Document ID Not Found
"500":
description: Internal Server Error
summary: Get Airport Document
tags:
- Airport collection
/api/v1/airport/:
post:
description: 'Create Airport with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to create a new document with a
specified ID<br><br>Code: [`controllers/airportController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airportController.js)<br><br>Method:
`createAirport`'
parameters:
- description: Data to create a document
in: body
name: data
required: true
schema:
$ref: '#/definitions/models.Airport'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/models.Airport'
"400":
description: Bad Request
"409":
description: Airport Document already exists
"500":
description: Internal Server Error
summary: Insert Airport Document
tags:
- Airport collection
put:
description: 'Update Airport with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to create a new document with a
specified ID<br><br>Code: [`controllers/airportController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airportController.js)<br><br>Method:
`updateAirport`'
parameters:
- description: Updates document
in: body
name: data
required: true
schema:
$ref: '#/definitions/models.Airport'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Airport'
"400":
description: Bad Request
"500":
description: Internal Server Error
summary: Update Airport Document
tags:
- Airport collection
/api/v1/airport/direct-connections:
get:
description: 'Get Direct Connections from specified Airport<br><br>This provides
an example of using a SQL++ query in Ottoman to fetch a list of documents
matching the specified criteria.<br><br>Code: [`controllers/airportController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airportController.js)<br><br>Method:
`getDirectConnections`'
parameters:
- description: 'Source airport<br>Example: SFO, LHR, CDG'
in: query
name: airport
required: true
type: string
- description: 'Number of direct connections to return (page size)<br>Default
value : 10'
in: query
name: limit
type: integer
- description: 'Number of direct connections to skip (for pagination)<br>Default
value : 0'
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/models.Destination'
type: array
"500":
description: Internal Server Error
summary: Get Direct Connections from Airport
tags:
- Airport collection
/api/v1/airport/list:
get:
description: 'Get list of Airports. Optionally, you can filter the list by Country<br><br>This
provides an example of using a SQL++ query in Couchbase using Ottoman to fetch a list of
documents matching the specified criteria.<br><br>Code: [`controllers/airportController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/airportController.js)<br><br>Method:
`listAirports`'
parameters:
- description: 'Country<br>Example: United Kingdom, France, United States'
in: query
name: country
type: string
- description: 'Number of airports to return (page size)<br>Default value :
10'
in: query
name: limit
type: integer
- description: 'Number of airports to skip (for pagination)<br>Default value
: 0'
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/models.Airport'
type: array
"500":
description: Internal Server Error
summary: List Airport Document
tags:
- Airport collection
/api/v1/route/{id}:
delete:
description: 'Delete Route with specified ID<br><br>This provides an example
of using Key Value operations in Couchbase using Ottoman to create a new document with a
specified ID<br><br>Code: [`controllers/routeController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/routeController.js)<br><br>Method:
`deleteRoute`'
parameters:
- description: Route ID like route_10000
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"204":
description: Route Deleted
"404":
description: Route Document ID Not Found
"500":
description: Internal Server Error
summary: Delete Route Document
tags:
- Route collection
get:
description: 'Get Route with specified ID<br><br>This provides an example of
using Key Value operations in Ottoman to create a new document with a specified
ID<br><br>Code: [`controllers/routeController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/routeController.js)<br><br>Method: `getRoute`'
parameters:
- description: Route ID like route_10000
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Route'
"404":
description: Route Document ID Not Found
"500":
description: Internal Server Error
summary: Get Route Document
tags:
- Route collection
/api/v1/route/:
post:
description: 'Create Route with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to create a new document with a
specified ID<br><br>Code: [`controllers/routeController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/routeController.js)<br><br>Method:
`createRoute`'
parameters:
- description: Data to create a document
in: body
name: data
required: true
schema:
$ref: '#/definitions/models.Route'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/models.Route'
"400":
description: Bad Request
"409":
description: Route Document already exists
"500":
description: Internal Server Error
summary: Insert Route Document
tags:
- Route collection
put:
description: 'Update Route with specified ID<br><br>This provides an example
of using Key Value operations in Ottoman to create a new document with a
specified ID<br><br>Code: [`controllers/routeController.js`](https://github.com/couchbase-examples/ottomanjs-quickstart/blob/master/src/controllers/routeController.js)<br><br>Method:
`updateRoute`'
parameters:
- description: Updates document
in: body
name: data
required: true
schema:
$ref: '#/definitions/models.Route'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Route'
"400":
description: Bad Request
"500":
description: Internal Server Error
summary: Update Route Document
tags:
- Route collection
swagger: "2.0"