This repository has been archived by the owner on Jun 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
swagger.json
869 lines (869 loc) · 38.3 KB
/
swagger.json
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
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
{
"swagger": "2.0",
"info": {
"title": "PPnet API",
"description": "This API description is written for PPnet.",
"version": "0.1.0"
},
"host": "couchdb.simple-url.com:5984",
"schemes": [
"http"
],
"produces": [
"application/json",
"text/plain; charset=utf-8"
],
"consumes": [
"application/json",
"text/plain"
],
"paths": {
"/{db}": {
"post": {
"summary": "Create",
"description": "Creates a new document in the specified database, using the supplied JSON document structure. If the JSON structure includes the _id field, then the document will be created with the specified document ID. If the _id field is not specified, a new unique ID will be generated, following whatever UUID algorithm is configured for that server.",
"parameters": [
{
"name": "db",
"in": "path",
"required": true,
"description": "Database name",
"type": "string"
},
{
"name": "batch",
"in": "query",
"required": false,
"description": "Stores document in batch mode",
"type": "string",
"enum": [
"ok"
]
},
{
"name": "document",
"in": "body",
"schema": {
"type": "string",
"description": "The document as JSON"
}
}
],
"responses": {
"201": {
"description": "Document created and stored on disk",
"schema": {
"properties": {
"id": {
"type": "string",
"description": "Document ID"
},
"ok": {
"type": "boolean",
"description": "Operation status"
},
"rev": {
"type": "string",
"description": "Revision info"
}
}
}
},
"202": {
"description": "Document data accepted, but not yet stored on disk",
"schema": {
"properties": {
"id": {
"type": "string",
"description": "Document ID"
},
"ok": {
"type": "boolean",
"description": "Operation status"
}
}
}
},
"400": {
"description": "Invalid database name"
},
"401": {
"description": "Write privileges required"
},
"404": {
"description": "Database doesn’t exist"
},
"409": {
"description": "A Conflicting Document with same ID already exists"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/{db}/_all_docs": {
"post": {
"summary": "List",
"description": "The POST to _all_docs allows to specify multiple keys to be selected from the database. This enables you to request multiple documents in a single request, in place of multiple GET /{db}/{docid} requests.",
"parameters": [
{
"name": "db",
"in": "path",
"required": true,
"description": "Database name",
"type": "string"
},
{
"name": "docids",
"in": "body",
"required": true,
"description": "The requested DocIDs",
"schema": {
"properties": {
"keys": {
"type": "array",
"description": "Array of requested DocIDs",
"items": {
"type": "string",
"description": "DocID"
}
}
}
}
}
],
"responses": {
"200": {
"description": "The returned JSON is the all documents structure, but with only the selected keys in the output",
"schema": {
"$ref": "#/definitions/DbAllDocsResponse"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"get": {
"summary": "Returns the structure of all documents",
"description": "Returns a JSON structure of all of the documents in a given database. The information is returned as a JSON structure containing meta information about the return structure, including a list of all documents and basic contents, consisting the ID, revision and key. The key is the from the document’s _id.",
"parameters": [
{
"name": "db",
"in": "path",
"required": true,
"description": "Database name",
"type": "string"
},
{
"name": "conflicts",
"in": "query",
"required": false,
"description": "Includes conflicts information in response. Ignored if include_docs isn’t true",
"type": "boolean",
"default": false
},
{
"name": "descending",
"in": "query",
"required": false,
"description": "Return the documents in descending by key order.",
"type": "boolean",
"default": false
},
{
"name": "endkey",
"in": "query",
"required": false,
"description": "Stop returning records when the specified key is reached.",
"type": "string"
},
{
"name": "end_key",
"in": "query",
"required": false,
"description": "Alias for endkey param.",
"type": "string"
},
{
"name": "endkey_docid",
"in": "query",
"required": false,
"description": "Stop returning records when the specified document ID is reached.",
"type": "string"
},
{
"name": "end_key_doc_id",
"in": "query",
"required": false,
"description": "Alias for endkey_docid param.",
"type": "string"
},
{
"name": "include_docs",
"in": "query",
"required": false,
"description": "Include the full content of the documents in the return.",
"type": "boolean",
"default": false
},
{
"name": "inclusive_end",
"in": "query",
"required": false,
"description": "Specifies whether the specified end key should be included in the result.",
"type": "boolean",
"default": true
},
{
"name": "key",
"in": "query",
"required": false,
"description": "Return only documents that match the specified key",
"type": "string"
},
{
"name": "limit",
"in": "query",
"required": false,
"description": "Limit the number of the returned documents to the specified number.",
"type": "number",
"format": "integer"
},
{
"name": "skip",
"in": "query",
"required": false,
"description": "Skip this number of records before starting to return the results.",
"type": "number",
"format": "integer",
"default": 0
},
{
"name": "stale",
"in": "query",
"required": false,
"description": "Allow the results from a stale view to be used, without triggering a rebuild of all views within the encompassing design doc.",
"type": "string",
"enum": [
"ok",
"update_after"
]
},
{
"name": "startkey",
"in": "query",
"required": false,
"description": "Return records starting with the specified key.",
"type": "string"
},
{
"name": "start_key",
"in": "query",
"required": false,
"description": "Alias for startkey param.",
"type": "string"
},
{
"name": "startkey_docid",
"in": "query",
"required": false,
"description": "Return records starting with the specified document ID.",
"type": "string"
},
{
"name": "start_key_doc_id",
"in": "query",
"required": false,
"description": "Alias for startkey_docid param.",
"type": "string"
},
{
"name": "update_seq",
"in": "query",
"required": false,
"description": "Response includes an update_seq value indicating which sequence id of the underlying database the view reflects.",
"type": "boolean",
"default": false
}
],
"responses": {
"200": {
"description": "Request completed successfully",
"schema": {
"$ref": "#/definitions/DbAllDocsResponse"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/{db}/_bulk_docs": {
"post": {
"summary": "Get multiple docs",
"description": "The POST to _all_docs allows to specify multiple keys to be selected from the database. This enables you to request multiple documents in a single request, in place of multiple GET /{db}/{docid} requests.",
"parameters": [
{
"name": "requestjson",
"in": "body",
"required": true,
"description": "The requested DocIDs",
"schema": {
"properties": {
"all_or_nothing": {
"type": "boolean",
"description": "Sets the database commit mode to use all-or-nothing semantics",
"default": false
},
"new_edits": {
"type": "boolean",
"description": "If false, prevents the database from assigning them new revision IDs.",
"default": true
},
"docs": {
"type": "array",
"description": "null",
"items": {
"properties": {
"_id": {
"type": "string",
"description": "The ID"
},
"_rev": {
"type": "string",
"description": "The revision"
},
"_deleted": {
"type": "boolean",
"description": "Is the doc delted"
}
},
"required": [
"_id"
]
}
}
}
}
},
{
"name": "db",
"in": "path",
"required": true,
"description": "Database name",
"type": "string"
}
],
"responses": {
"201": {
"description": "Document(s) have been created or updated",
"schema": {
"type": "array",
"items": {
"properties": {
"ok": {
"type": "boolean",
"description": "Is the value ok?"
},
"id": {
"type": "string",
"description": "The ID"
},
"rev": {
"type": "string",
"description": "The revision"
},
"error": {
"type": "string",
"description": "Error type"
},
"reason": {
"type": "string",
"description": "Error reason"
}
},
"required": [
"id"
]
}
}
},
"400": {
"description": "The request provided invalid JSON data"
},
"417": {
"description": "Occurs when all_or_nothing option set as true and at least one document was rejected by validation function"
},
"500": {
"description": "Malformed data provided, while it’s still valid JSON"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/{db}/{docid}": {
"head": {
"summary": "Get minimal information about the docs",
"description": "Returns the HTTP Headers containing a minimal amount of information about the specified document. The method supports the same query arguments as the GET /{db}/{docid} method, but only the header information (including document size, and the revision as an ETag), is returned.The ETag header shows the current revision for the requested document, and the Content-Length specifies the length of the data, if the document were requested in full.Adding any of the query arguments (see GET /{db}/{docid}), then the resulting HTTP Headers will correspond to what would be returned.",
"parameters": [
{
"name": "db",
"in": "path",
"required": true,
"description": "Database name",
"type": "string"
},
{
"name": "docid",
"in": "path",
"required": true,
"description": "Doc-ID",
"type": "string"
}
],
"responses": {
"200": {
"description": "Document exists"
},
"304": {
"description": "Document wasn’t modified since specified revision"
},
"401": {
"description": "Read privilege required"
},
"404": {
"description": "Document not found"
}
}
},
"get": {
"summary": "Read",
"description": "Returns document by the specified docid from the specified db. Unless you request a specific revision, the latest revision of the document will always be returned.",
"parameters": [
{
"name": "db",
"in": "path",
"required": true,
"description": "Database name",
"type": "string"
},
{
"name": "docid",
"in": "path",
"required": true,
"description": "Doc-ID",
"type": "string"
},
{
"name": "attachments",
"in": "query",
"required": false,
"description": "Includes attachments bodies in response.",
"type": "boolean",
"default": false
},
{
"name": "att_encoding_info",
"in": "query",
"required": false,
"description": "Includes encoding information in attachment stubs if the particular attachment is compressed.",
"type": "boolean",
"default": false
},
{
"name": "atts_since",
"in": "query",
"required": false,
"description": "Includes attachments only since specified revisions. Doesn’t includes attachments for specified revisions.",
"type": "array",
"items": {
"type": "string"
},
"default": null
},
{
"name": "conflicts",
"in": "query",
"required": false,
"description": "Includes information about conflicts in document.",
"type": "boolean",
"default": false
},
{
"name": "deleted_conflicts",
"in": "query",
"required": false,
"description": "Includes information about deleted conflicted revisions.",
"type": "boolean",
"default": false
},
{
"name": "latest",
"in": "query",
"required": false,
"description": "Forces retrieving latest “leaf” revision, no matter what rev was requested.",
"type": "boolean",
"default": false
},
{
"name": "local_seq",
"in": "query",
"required": false,
"description": "Includes last update sequence number for the document.",
"type": "boolean",
"default": false
},
{
"name": "meta",
"in": "query",
"required": false,
"description": "Acts same as specifying all conflicts, deleted_conflicts and open_revs query parameters. ",
"type": "boolean",
"default": false
},
{
"name": "open_revs",
"in": "query",
"required": false,
"description": "Retrieves documents of specified leaf revisions.",
"type": "array",
"items": {
"type": "string"
}
},
{
"name": "rev",
"in": "query",
"required": false,
"description": "Retrieves document of specified revision. Optional",
"type": "string"
},
{
"name": "revs",
"in": "query",
"required": false,
"description": "Includes list of all known document revisions.",
"type": "boolean",
"default": false
},
{
"name": "revs_info",
"in": "query",
"required": false,
"description": " Includes detailed information for all known document revisions.",
"type": "boolean",
"default": false
}
],
"responses": {
"200": {
"description": "Request completed successfully",
"schema": {
"properties": {
"_id": {
"type": "string",
"description": "Document ID"
},
"_rev": {
"type": "string",
"description": "Revision MVCC token"
},
"_deleted": {
"type": "boolean",
"description": "Deletion flag. Available if document was removed"
},
"_attachments": {
"description": "",
"type": "object"
},
"_conflicts": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of conflicted revisions. Available if requested with conflicts=true query parameter"
},
"_deleted_conflicts": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of deleted conflicted revisions. Available if requested with deleted_conflicts=true query parameter"
},
"_local_seq": {
"type": "number",
"format": "integer",
"description": "Document’s sequence number in current database. Available if requested with local_seq=true query parameter"
},
"_revs_info": {
"type": "array",
"items": {
"properties": {
"rev": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"available",
"missing",
"deleted"
]
}
}
},
"description": "List of objects with information about local revisions and their status. Available if requested with open_revs query parameter"
},
"_revisions": {
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
}
},
"start": {
"type": "number"
}
},
"description": "List of local revision tokens without. Available if requested with revs=true query parameter"
}
},
"required": [
"_id",
"_rev"
]
}
},
"304": {
"description": "Document wasn’t modified since specified revision"
},
"400": {
"description": "The format of the request or revision was invalid"
},
"401": {
"description": "Read privilege required"
},
"404": {
"description": "Document not found"
}
}
},
"put": {
"summary": "Update",
"description": "The PUT method creates a new named document, or creates a new revision of the existing document. Unlike the POST /{db}, you must specify the document ID in the request URL.",
"parameters": [
{
"name": "db",
"in": "path",
"required": true,
"description": "Database name",
"type": "string"
},
{
"name": "docid",
"in": "path",
"required": true,
"description": "Doc-ID",
"type": "string"
},
{
"name": "batch",
"in": "query",
"required": false,
"description": "Stores document in batch mode",
"type": "string",
"enum": [
"ok"
]
}
],
"responses": {
"201": {
"description": "Document created and stored on disk",
"schema": {
"properties": {
"id": {
"type": "string",
"description": "Document ID"
},
"ok": {
"type": "boolean",
"description": "Operation status"
},
"rev": {
"type": "string",
"description": "Revision MVCC token"
}
}
}
},
"202": {
"description": "Document data accepted, but not yet stored on disk"
},
"400": {
"description": "Invalid request body or parameters"
},
"401": {
"description": "Write privileges required"
},
"404": {
"description": "Specified database or document ID doesn’t exists"
},
"409": {
"description": "Document with the specified ID already exists or specified revision is not latest for target document"
}
}
},
"delete": {
"summary": "Delete",
"description": "Marks the specified document as deleted by adding a field _deleted with the value true. Documents with this field will not be returned within requests anymore, but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.",
"parameters": [
{
"name": "db",
"in": "path",
"required": true,
"description": "Database name",
"type": "string"
},
{
"name": "docid",
"in": "path",
"required": true,
"description": "Doc-ID",
"type": "string"
},
{
"name": "rev",
"in": "query",
"required": false,
"description": " Actual document’s revision",
"type": "string"
},
{
"name": "batch",
"in": "query",
"required": false,
"description": "Stores document in batch mode Possible values: ok. Optional.",
"type": "string",
"enum": [
"ok"
]
}
],
"responses": {
"200": {
"description": "Document successfully removed",
"schema": {
"properties": {
"id": {
"type": "string",
"description": "Document ID"
},
"ok": {
"type": "boolean",
"description": "Operation status"
},
"rev": {
"type": "string",
"description": "Revision MVCC token"
}
}
}
},
"202": {
"description": "Request was accepted, but changes are not yet stored on disk"
},
"400": {
"description": "Invalid request body or parameters"
},
"401": {
"description": "Write privileges required"
},
"404": {
"description": "Specified database or document ID doesn’t exists"
},
"409": {
"description": "Specified revision is not the latest for target document"
}
}
}
}
},
"definitions": {
"DbAllDocsResponse": {
"properties": {
"offset": {
"type": "number",
"format": "integer",
"description": "Offset where the document list started"
},
"rows": {
"type": "array",
"description": "Array of view row objects. By default the information returned contains only the document ID and revision.",
"items": {
"properties": {
"id": {
"type": "string",
"description": "The id"
},
"key": {
"type": "string",
"description": "A key"
},
"value": {
"properties": {
"rev": {
"type": "string",
"description": "The revision"
}
}
}
}
}
},
"total_rows": {
"type": "number",
"format": "integer",
"description": "Number of documents in the database/view. Note that this is not the number of rows returned in the actual query."
},
"update_sequence": {
"type": "number",
"format": "integer",
"description": "Current update sequence for the database"
}
}
},
"Error": {
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"fields": {
"type": "string"
}
}
}
}
}