-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi.yaml
More file actions
1499 lines (1415 loc) · 55.2 KB
/
api.yaml
File metadata and controls
1499 lines (1415 loc) · 55.2 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
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
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
security: []
servers:
- url: 'http://{tenant}:8080'
variables:
tenant:
default: localhost
description: The running test server
info:
title: Couchbase Lite Test Server API
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
description: |-
This is a REST API specification for Couchbase Lite Test Server.
The APIs except GET [/](#operation/getInfo) requires the following request headers:
* CBLTest-API-Version (integer)
* CBLTest-Client-ID (UUID)
The response headers of all APIs will contains the following response headers:
* CBLTest-API-Version (integer)
* CBLTest-Server-ID (UUID)
Enum values:
* Any enum values in the spec are case insensitive.
KeyPath:
* The [/updateDatabase](#operation/updateDatabase) and [/verifyDocuments](#operation/verifyDocuments) API are using the JSON's keypath to
refer to a specific path in the document's properties tree.
* The keypath structure can be described as follows:
```
keypath ::= ( [ DOLLAR DOT ] <property> | <index> ) <path>
path ::= (DOT <property> | <index>)* EOP
index ::= OBRACKET DIGIT+ CBRACKET
property ::= ANY+
EOP ::= End of path
DOT ::= '.'
DOLLAR ::= '$'
OBRACKET ::= '['
CBRACKET ::= ']'
DIGIT ::= '0' |'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
ANY ::= (! (DOT | OBRACKET | CBRACKET | EOP) ) | ESCAPE
ESCAPE ::= '\' (! EOP )
```
Changes
2.0.2 (07/24/2025)
* Add peer ID property to return value of [/startMultipeerReplicator](#operation/startMultipeerReplicator)
2.0.1 (07/10/2025)
* Add Merge-Dict Conflict Resolver
2.0.0 (06/13/2025)
* This is a breaking change: CBLTest-API-Version is now "2"
* deprecate dataset_version
* In ResetConfiguration, change the value for the "dataset" key to a url.
* In UpdateDatabase and VerifyDocuments change the updatedBlobs keys to urls
1.2.3 (12/09/2025)
* Add transport type selection to [/startMultipeerReplicator](#operation/startMultipeerReplicator)
1.2.2 (09/19/2025)
* Add headers property to ReplicatorConfiguration
1.2.1 (06/04/2025)
* Add authenticator property to [/startMultipeerReplicator](#operation/startMultipeerReplicator)
1.2.0 (04/09/2025)
* Add [/startMultipeerReplicator](#operation/startMultipeerReplicator),
* Add [/stopMultipeerReplicator](#operation/stopMultipeerReplicator) endpoint
* Add [/getMultipeerReplicatorStatus](#operation/getMultipeerReplicatorStatus) endpoint
1.1.1 (04/26/2025)
* Modify newSession to accept dataset_version to set the version of the dataset to be downloaded
1.1.0 (03/05/2025)
* Add [/startListener](#operation/startListener) and [/stopListener](#operation/stopListener) endpoint
1.0.0 (09/27/2024)
* Replace setupLogging endpoint with expanded newSession endpoint
* Add [/log](#operation/log) endpoint
0.5.2 (09/25/2024)
* Split getDocument into database and document key to more closely match other API
0.5.1 (09/24/2024)
* Added reset parameter "test"
* Permit null as a collection list in reset
* getDocument returns status 404 on doc not found.
0.5.0 (09/17/2024)
* Updated reset payload structure
* Added stopReplicator
* Added getDocument
0.4.0 (08/29/2024)
* Added runQuery endpoint
0.3.1 (08/13/24)
* Added conflictResolver to ReplicationCollectionEntry
* Added special "empty" dataset to indicate a new empty database locally
0.3.0 (08/10/24)
* Added setupLogging endpoint
0.2.4 (08/07/24)
* Added pinnedServerCert to ReplicatorConfig
0.2.3 (08/30/23)
* Updated blob verification logic.
* Added rules for determining blob's content_type.
0.2.2 (08/25/23)
* Added updatedBlobs option to /updateDatabase.
* Added verification logic info including blob verification logic in /verifyDocuments.
* Added blob file doesn't exist reason to /verifyDocuments description.
* Added new /performMaintenance API
0.2.1 (08/18/23)
* Added note about out-of-scope functions to /verifyDocuments.
* Changed wording in /snapshotDocuments description.
0.2.0 (08/17/23)
* Change verifyDocuments to verify all documents in snaphot
0.1.9 (08/16/23)
* Added ReplicatorConfiguration.enableAutoPurge
* Added actual, expected, and document key to verifyDocuments's result
0.1.8 (08/08/23)
* Fixed missing ReplicationCollection.pullFilter
* Added spec/replication-filter.md
* Made DocumentReplication.flags required
0.1.7 (08/04/23)
* Fixed missing database in snapshotDocuments request
* Added required keys to snapshotDocuments request
* Add 'description' key to the verifyDocuments response
0.1.6 (08/04/23)
* Added JSON Path Spec to /updateDatabase
0.1.5 (08/02/23)
* Changed /updateDatabase to use keypaths for specifying the changes
0.1.4 (07/28/23)
* Fixed required fields and update description in ServerInfo.
* Added additionalInfo to the ServerInfo.
* Fixed required fields in ReplicationCollection.
* Changed DocumentReplication.flags type from int to array of enums.
* Added 'enableDocumentListener' to ReplicatorConfiguration.
* Added a note that any enum values are case insensitive.
version: 2.0.2
tags:
- name: API
description: The API endpoints of the test server
paths:
/:
get:
operationId: getInfo
tags:
- API
summary: Get Test Server information
description: |-
Get Test Server information containing the following information (tentative):
* version : Test Server version number which is the same as CBL release number.
* apiVersion: API version number. This will increase when we have breaking change.
* cbl: The name of the CBL library used.
* device : Device or platform information that the test server is running on.
* additionalInfo: Any additional info regarding the server.
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ServerInfo'
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/reset:
post:
tags:
- API
summary: Reset the test server
description: |-
Reset the test server by deleting all of the databases and re-creating new databases as specified.
operationId: reset
requestBody:
description: |-
The request object describes how the databases will be setup after being reset. The request
contains one optional key named "databases" which specifies the databases to be created.
If not specified, no databases will be created.
content:
application/json:
schema:
$ref: '#/components/schemas/ResetConfiguration'
required: true
responses:
'200':
description: Success
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/getAllDocuments:
post:
tags:
- API
summary: Get all documents
description: Get info including of document IDs and revision IDs all document from the specified collections
operationId: getAllDocuments
requestBody:
description: |-
The request object provides a list of the collections in the specified database. The properties include:
* **database** : The database name
* **collections** : An array of the collection names. The collection name is in the <scope-name>.<collection-name> format.
If the specified database is not found, the 400 error will be returned.
If the specified collections are not found, the response will not included the collections in its body.
content:
application/json:
schema:
$ref: '#/components/schemas/Collections'
required: true
responses:
'200':
description: |-
Success
The response body is an object where key is the collection name and the value is an array of objects containing document info including two keys, 'id' (documentID) and rev (revisionID).
If the specified collections in the request, the dictionary will not contain those collections.
content:
application/json:
schema:
$ref: '#/components/schemas/CollectionDocuments'
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/getDocument:
post:
tags:
- API
summary: Get a document.
description: |-
Get a document by the document ID. The result is a dictionary containing
document's properties and its metadata which are document ID and revision history.
operationId: getDocument
requestBody:
description: |-
The request object containing the collection name and document ID.
content:
application/json:
schema:
type: object
required: ['database', 'document']
properties:
database:
type: string
example: 'db1'
document:
$ref: '#/components/schemas/DocumentID'
required: true
responses:
'200':
description: |-
Success
The response body is an object containing document properties and metadata. The metadata
keys are :
* _id : Document ID
* _revs: Revision history including the current revision ID as the first item.
The format of the revision history is described in this document:
https://github.com/couchbase/couchbase-lite-core/blob/master/modules/docs/pages/replication-protocol.adoc#4-revision-ids-and-histories
content:
application/json:
schema:
$ref: '#/components/schemas/Document'
'400':
$ref: '#/components/responses/Error'
'404':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/updateDatabase:
post:
tags:
- API
summary: Update documents in the database.
description: |-
Perform document updates in batch. The request body contains an array of DatabaseUpdateItem object which describes
how documents are updated, deleted or purged. For updating a document, the changes to the document are specified
in 'updatedProperties' and 'removedProperties'.
- **updatedProperties**:
An array of objects. Each object contains one or more keys that are key paths into the document to be updated with the
values associated with the keys. The objects in the array are evaluated in their natural order.
The keypath identifies a unique location in the document's property tree starting from the root that follows
dictionary properties and array elements. The keypath looks like "foo.bar[1].baz". The keypath structure can be found
in the description at the beginning of this specification.
The value at the location specified by the keypath is replaced with the value associated with the keypath, in the object
regardless of its type. When a path in the keypath refers to a non-existent property, the key is added and
its value set as a dictionary or an array depending on the type of the path.
When a path in the keypath includes an array index that is out of bounds (the array is smaller than the specified index), the array
is padded with nulls until it is exactly large enough to make the specified index legal.
When a path (dictionary or array) in the keypath doesn't match the actual value type, the error will be returned.
Examples :
```
Document:
{
"name", {"first": "John", "last": "Doe"},
"addresses": [{"city": "San Francisco"}, {"city": "Palo Alto"}]
}
Updates:
name.last = "Tiger" -> {"name", {"first": "John", "last": "Tiger"}, ...}
name.middle = "Sky" -> {"name", {"first": "John", "middle": "sky", "last": "Tiger"}, ...}
name = "John Doe" -> {"name", "John Doe"}
name.first.value = "John" -> Error as the value of "first" is not the dictionary
addresses[0].city = "Santa Clara" -> {"addresses": [{"city": "Santa Clara"}, {"city": "Palo Alto"}], ...}
addresses[4].city = "San Mateo" -> {"addresses": [{"city": "Santa Clara"}, {"city": "Palo Alto"}, null, {"city": "San Mateo"}], ...}
phones[1] = "650-123-4567" -> {"phones": [null, "650-123-4567"]}
```
- **removedProperties**:
An array of the key paths which refer to ditionary keys or array elements to be removed. If a keypath refer to a non-existent
property or array element, the remove for the keypath will be no-ops. When removing multiple items in an array, the order of the array indexes
should be from high to low to avoid index mutation during the removal.
- **updatedBlobs**:
A dictionary whose keys are the key paths into the document to be updated with the blob objects and values are
the urls from which to retrieve the blobs to be put at the key path location.
The logic to update blobs is similar to the logic when updating properties. The value at the location specified
by the keypath is replaced with the blob object regardless of the value's type. When a path in the keypath
refers to a non-existent property, the key is added and its value set as a dictionary or an array depending on
the type of the path. When a path in the keypath includes an array index that is out of bounds, the array
is padded with nulls until it is exactly large enough to make the specified index legal.
The blob object is created from the content of the blob file to which the blob url refers: the value associated
with the keypath in the request. If the name of the file retrieved from the url ends with the extension ".zip"
the file is unzipped, first, to recover the blob. If the blob file name refers to non-existing blob file,
a 400 request error will be returned.
The content_type of the blob used when creating a blob object can be detected from the blob file name's extension
(after it is unzipped, if necessary) according to the following rules:
* "image/jpeg" for the .jpg
* "application/octet-stream" for others
operationId: updateDatabase
requestBody:
description: |-
The request object containing document update items that will be performed in batch.
content:
application/json:
schema:
type: object
required: ['database', 'updates']
properties:
database:
type: string
example: 'db1'
updates:
type: array
items:
$ref: '#/components/schemas/DatabaseUpdateItem'
required: true
responses:
'200':
description: Success
'400':
$ref: '#/components/responses/Error'
'404':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/startReplicator:
post:
tags:
- API
summary: Create and start a replicator
description: |-
Create and start a replicator. If success, the created replicator identifier will be returned.
operationId: startReplicator
requestBody:
description: |-
The request object containing the replicator configuration and the reset checkpoint flag
used when starting the replicator.
Note:
- If no collections specified, the replicator will be created with the database which means
the default collection will be used.
- 400 Error returned when no collections set in the specified collection
content:
application/json:
schema:
type: object
required: ['config']
properties:
config:
$ref: '#/components/schemas/ReplicatorConfiguration'
reset:
type: boolean
example: false
required: true
responses:
'200':
description: |-
Success
The response body is an object containing the replicator object identifier.
content:
application/json:
schema:
$ref: '#/components/schemas/Replicator'
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/stopReplicator:
post:
tags:
- API
summary: Stop a replicator
description: |-
Stop a replicator.
Note:
- Return 400 error when the specified replicator is not found.
- The stopped replicator cannot be restarted.
operationId: stopReplicator
requestBody:
description: |-
The request object containing the replicator identifier.
content:
application/json:
schema:
$ref: '#/components/schemas/Replicator'
required: true
responses:
'200':
description: Success
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/getReplicatorStatus:
post:
tags:
- API
summary: Get the current status of the replicator
description: Get the current status of the replicator.
operationId: getReplicatorStatus
requestBody:
description: |-
The request object containing the replicator identifier.
content:
application/json:
schema:
$ref: '#/components/schemas/Replicator'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ReplicatorStatus'
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/snapshotDocuments:
post:
tags:
- API
summary: Snapshot documents for verifying changes
description: |-
Given a list of document IDs, snapshot the documents by getting and saving the documents in the memory.
The non-existing or deleted documents will be recorded as null in the snapshot.
The API will return a UUID of the snapshot, which can be used when calling POST /verifyDocuments to
verify changes against the snapshot, for example, after finishing replication.
operationId: snapshotDocuments
requestBody:
description: |-
The request object containing the IDs of the documents to be snapshotted.
content:
application/json:
schema:
type: object
required: ['database', 'documents']
properties:
database:
type: string
example: 'db1'
documents:
type: array
items:
$ref: '#/components/schemas/DocumentID'
required: true
responses:
'200':
description: |-
Success
The response body is an object containing the snapshot identifier.
content:
application/json:
schema:
type: object
required: ['id']
properties:
id:
type: string
format: uuid
example: '123e0000-e89b-12d3-a456-426614174000'
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/verifyDocuments:
post:
tags:
- API
summary: Verify document changes from a document snapshot.
description: |-
Verify all documents in the snapshot. The request body contains a list of changes to be verified.
For the snapped-shot documents that are not in the list of changes, the documents will be
verified as unchanged documents.
Verification Logic:
1. If the document specified in the delta doesn't exist in the snapshot, the 400 request error will be returned.
2. If the document specified in the delta with change type PURGE or DELETE, the corresponding snapshot document
value in the snaphot MUST be null.
3. If the document specified in the delta with change type UPDATE, the expected document which is the
corresponding snaphot document applied with the specified delta will be compared with the actual document
which is the current document in the collection. The body of expected and actual document MUST be the same.
4. When checking if the two blob objects (actual and expected) are equals, the platform blob's equals() method
will be used. If the two blob objects are equals, in addition, the blob content of the two blobs will be
compared. When reading the content of the actual blob, if the blob file is unexpectedly missing from
the database, there could be a runtime exception thrown, please make sure to catch the exception and
mark the verification result as failed with the appropriate description (See the case 6 in the response).
For the actual / expected value of the blob, use the blob's properties.
For that platform such as Swift that cannot catch the runtime exception to check that the blob is missing
when getting the blob's content, use Database's getBlob(Dictionary blobProperties) which will throw
CouchbaseLiteException when blob doesn't exist to get the same blob object for getting the blob content.
Note:
* The documents outside the snapshot will not be verified. To verify expected new documents
can be done by including these new documents (not existing before) to the snapshot and verifying
them with UPDATE changes.
* Verifying unexpected new documents is out-of-scope. To do that use either POST /getAllDocuments or
document replication listener to verify.
operationId: verifyDocuments
requestBody:
description: Verify document changes from the given document snapshot recorded by using POST /snapshotDocuments.
content:
application/json:
schema:
type: object
required: ['database', 'snapshot', 'changes']
properties:
database:
type: string
example: 'db1'
snapshot:
type: string
format: uuid
example: '123e0000-e89b-12d3-a456-426614174000'
changes:
type: array
items:
$ref: '#/components/schemas/DatabaseUpdateItem'
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
required: ['result']
properties:
result:
type: boolean
example: false
description:
description: |-
Describing about the failed verification result. The information includes the document id,
and the reason that causes the verification to failed as follows:
Case 1 : Document should exists in the collection but it doesn't exist to verify.
Reason : Document '<doc-id>' in '<scope.collection>' was not found
Case 2 : Document should be deleted but it wasn't.
Reason : Document '<doc-id>' in '<scope.collection>' was not deleted
Case 3 : Document should be purged but it wasn't.
Reason : Document '<doc-id>' in '<scope.collection>' was not purged
Case 4 : Document has unexpected properties.
Reason : Document '<doc-id> in '<scope.collection>' had unexpected properties at key '<keypath>'
Case 5 : Document shouldn't exist (null value in the snapshot), but the document does exist.
Reason : Document '<doc-id> in '<scope.collection>' should not exist
Case 6 : Blob file doesn't exist in the database.
Reason : Document '<doc-id> in '<scope.collection>' had non-existing blob at key '<keypath>'
For the Case, The first unexpected keypath is shown in the reason description.
Its actual value, expected value, and the entire actual document body will be shown in
'actual', 'expected', 'document' key of the verification result object separately. If
the value of the 'actual' or 'expected' key is MISSING, the key will be omitted.
The following cases are listed as request errors (response status = 400):
Error Case 1 : The specified database in the request was not found.
Error Case 2 : The specified snapshot was not found.
Error Case 3 : The document in the collection to be verified didn't exist in the snapshot.
type: string
example: "Document 'doc-1' in 'scope.collection' has unexpected properties at key 'address.city'"
actual:
description: |-
The actual value of the unexpected keypath. If the actual keypath doesn't exist,
this 'actual' key will be omitted.
oneOf:
- type: boolean
- type: integer
- type: number
- type: string
- type: object
- type: array
example: "Santa Clara"
expected:
description: |-
The expected value of the unexpected keypath. If the expected keypath doesn't exist, this 'expected'
key will be omitted.
oneOf:
- type: boolean
- type: integer
- type: number
- type: string
- type: object
- type: array
example: "Santa Monica"
document:
description: |-
The actual document body of the document that has unexpected properties.
type: object
additionalProperties: {}
example: {'name': 'John Doe', 'address': {'city': 'Santa Clara', 'state': 'CA'}}
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/performMaintenance:
post:
tags:
- API
summary: Perform Database Maintenance
description: Perform maintenance on the specified database per the specified maintenance type
operationId: performMaintenance
requestBody:
description: |-
The request object specifies the name of the database and the performance type be be performed on.
If the database doesn't exist, 400 request error will be returned.
content:
application/json:
schema:
$ref: '#/components/schemas/PerformMaintenanceConfiguration'
required: true
responses:
'200':
description: Success
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/newSession:
post:
tags:
- API
summary: Creates a new test session
description: |-
Creates a new session identified by a unique client ID. A session id (in the HTTP header CBLTest-Client-ID
for all requests) must be introduced using this endpoint. A request with a client id not introduced here is in error.
Optionally, this call allows instructing the test server to send all logging for the session
(both from the server and from the CBL library) to a specified log slurper.
operationId: newSession
requestBody:
description: |-
The request object specifies a client id and, optionally the URL of a log slurper and the tag to be used when logging to it.
content:
application/json:
schema:
$ref: '#/components/schemas/NewSession'
required: true
responses:
'200':
description: Success
'400':
$ref: '#/components/responses/Error'
/runQuery:
post:
tags:
- API
summary: Runs a SQL++ query against a database
description: Given a database and text query, executes the query and returns the result as JSON
operationId: runQuery
requestBody:
description: |-
The request object specifies the database and query
content:
application/json:
schema:
$ref: '#/components/schemas/RunQueryConfiguration'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/QueryResults'
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/log:
post:
tags:
- API
summary: Log a message to the server log
description: Given a message, immediately insert it into the server log stream
operationId: log
requestBody:
description: |-
The message to be logged
content:
application/json:
schema:
type: object
required: ['message']
properties:
message::
type: string
example: 'Client has caught fire'
responses:
'200':
description: Success
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/startListener:
post:
tags:
- API
summary: Starts a P2P listener
description: |-
Starts a P2P listener so that the device can act as the passive side of a P2P replication.
operationId: startListener
requestBody:
description: |-
The request object containing the collections to share and, optionally, the port to listen on and disableTLS flag.
content:
application/json:
schema:
type: object
required: ['database', 'collections']
properties:
database:
type: string
example: 'db1'
collections:
type: array
items:
type: string
example: 'store.cloths'
port:
type: integer
example: 12345
disableTLS:
type: boolean
required: true
responses:
'200':
description: |-
Success
The response body is an object containing the ID of the listener, and the port
it is listening on.
content:
application/json:
schema:
$ref: '#/components/schemas/StartListenerResponse'
'400':
$ref: '#/components/responses/Error'
'404':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/stopListener:
post:
tags:
- API
summary: Stops a P2P listener
description: |-
Stops a previously started P2P listener.
operationId: stopListener
requestBody:
description: |-
The request object containing the listener to stop.
content:
application/json:
schema:
type: object
required: ['id']
properties:
id:
type: string
format: uuid
example: '123e4567-e89b-12d3-a456-426614174000'
required: true
responses:
'200':
description: |-
Success
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/startMultipeerReplicator:
post:
tags:
- API
summary: Starts a Multipeer replicator
description: |-
Starts a multipeer replicator to create a mesh of connected clients.
operationId: startMultipeerReplicator
requestBody:
description: |-
The request object containing the collections to share and the peer group ID. Optionally,
it can contain an authenticator as well. The default (null) behavior is accept all connections.
content:
application/json:
schema:
type: object
required: ['peerGroupID', 'database', 'collections', 'identity']
properties:
peerGroupID:
type: string
example: 'com.couchbase.testing'
database:
type: string
example: 'db1'
collections:
type: array
items:
$ref: "#/components/schemas/ReplicationCollection"
identity:
$ref: '#/components/schemas/MultipeerReplicatorIdentity'
authenticator:
$ref: '#/components/schemas/MultipeerReplicatorCAAuthenticator'
transports:
type: array
items:
type: string
uniqueItems: true
minItems: 1
enum: ['wifi', 'bluetooth']
example: ['wifi', 'bluetooth']
required: true
responses:
'200':
description: |-
Success
The response body is an object containing the ID of the listener, and the port
it is listening on.
content:
application/json:
schema:
$ref: '#/components/schemas/MultipeerReplicator'
'400':
$ref: '#/components/responses/Error'
'404':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/stopMultipeerReplicator:
post:
tags:
- API
summary: Stops a Multipeer replicator
description: |-
Stops a previously started Multipeer Replicator.
operationId: stopMultipeerReplicator
requestBody:
description: |-
The request object containing the replicator to stop.
content:
application/json:
schema:
type: object
required: ['id']
properties:
id:
type: string
format: uuid
example: '123e4567-e89b-12d3-a456-426614174000'
required: true
responses:
'200':
description: |-
Success
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
/getMultipeerReplicatorStatus:
post:
tags:
- API
summary: Gets the status of a multipeer replicator
description: |-
Gets the status of a multipeer replicator
operationId: getMultipeerReplicatorStatus
requestBody:
description: |-
The request object containing the replicator to query.
content:
application/json:
schema:
type: object
required: ['id']
properties:
id:
type: string
format: uuid
example: '123e4567-e89b-12d3-a456-426614174000'
required: true
responses:
'200':
description: |-
Success
content:
application/json:
schema:
$ref: '#/components/schemas/MultipeerReplicatorStatus'
'400':
$ref: '#/components/responses/Error'
'500':
$ref: '#/components/responses/Error'
components:
schemas:
Collections:
type: object
required: ['database', 'collections']
properties:
database:
type: string
example: 'db1'
collections:
type: array
items:
type: string
example: ['catalog.cloths', 'catalog.shoes']
CollectionDocuments:
description: |-
Each key is a fully qualified collection name. The associated value is a list of objects that must have an "id" key,
and a "rev" key which is either a revtree id or a hlv cv
type: object
additionalProperties:
type: string
example: {
'catalog.cloths': [{'id': 'c1', 'rev': '800@Bob'}, {'id': 'c2', 'rev': '1-9ef'}],
'catalog.shoes': [{'id': 's1', 'rev': '1-ff0'}, {'id': 's2', 'rev': '1010@Alice'}]
}