-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
5012 lines (4799 loc) · 172 KB
/
openapi.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
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.0.0
info:
title: Nightscout API
version: 3.0.3
description: |2
Nightscout API v3 is a component of cgm-remote-monitor project. It aims to provide lightweight, secured and HTTP REST compliant interface for your T1D treatment data exchange.
API v3 uses these environment variables, among other things:
- Security switch (optional, default = `true`)
<pre>API3_SECURITY_ENABLE=true</pre>
You can turn the whole security mechanism off, e.g. for debugging or development purposes,
but this should never be set to false in production.
- Maximum limit count of documents retrieved from single query
<pre>API3_MAX_LIMIT=1000</pre>
- Autopruning of obsolete documents (optional, default is only `DEVICESTATUS`=60)
<pre>API3_AUTOPRUNE_DEVICESTATUS=60
API3_AUTOPRUNE_ENTRIES=365
API3_AUTOPRUNE_TREATMENTS=120
</pre>
You can specify for which collections autopruning will be activated and length of retention period in days, e.g. "Hold 60 days of devicestatus, automatically delete older documents, hold 365 days of treatments and entries, automatically delete older documents."
- Fallback deduplication switch (optional, default = true)
<pre>API3_DEDUP_FALLBACK_ENABLED=true</pre>
API3 uses the `identifier` field for document identification and mutual distinction within a single collection. There is automatic deduplication implemented matching the equal `identifier` field. E.g. `CREATE` operation for document having the same `identifier` as another one existing in the database is automatically transformed into `UPDATE` operation of the document found in the database.
Documents not created via API v3 usually does not have any `identifier` field, but we would like to have some form of deduplication for them, too. This fallback deduplication is turned on by having set `API3_DEDUP_FALLBACK_ENABLED` to `true`.
When searching the collection in database, the document is found to be a duplicate only when either he has equal `identifier` or he has no `identifier` and meets:
<pre>`devicestatus` collection: equal combination of `created_at` and `device`
`entries` collection: equal combination of `date` and `type`
`food` collection: equal `created_at`
`profile` collection: equal `created_at`
`treatments` collection: equal combination of `created_at` and `eventType`
</pre>
- Fallback switch for adding `created_at` field along the `date` field (optional, default = true)
<pre>API3_CREATED_AT_FALLBACK_ENABLED=true</pre>
Standard APIv3 document model uses only `date` field for storing a timestamp of the event recorded by the document. But there is a fallback option to fill `created_at` field as well automatically on each insert/update, just to keep all older components working.
tags: []
paths:
/v2/properties:
get:
operationId: v2_getProperties
parameters: []
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Properties'
/v2/properties/{properties}:
get:
operationId: v2_getSelectedProperties
parameters:
- name: properties
in: path
required: true
schema:
type: array
items:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Properties'
/v3/devicestatus:
post:
operationId: deviceStatusDocument_create
summary: 'CREATE: Inserts a new document into the collection'
description: >-
Using this operation you can insert new documents into collection.
Normally the operation ends with 201 HTTP status code, `Last-Modified`
and `Location` headers specified.
`identifier` is included in response body or it can be parsed from the
`Location` response header.
When the document to post is marked as a duplicate (using rules
described at `API3_DEDUP_FALLBACK_ENABLED` switch), the update operation
takes place instead of inserting. In this case the original document in
the collection is found and it gets updated by the actual operation POST
body. Finally the operation ends with 200 HTTP status code along with
`Last-Modified` and correct `Location` headers. The response body then
includes `isDeduplication`=`true` and `deduplicatedIdentifier` fields.
This operation provides autopruning of the collection (if autopruning is
enabled).
This operation requires `create` (and/or `update` for deduplication)
permission for the API and the collection (e.g. `api:treatments:create`
and `api:treatments:update`)
parameters: []
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/updatedDocument'
'201':
description: >-
The request has succeeded and a new resource has been created as a
result.
headers:
Location:
required: true
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/createdDocument'
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
'401':
description: Access is unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedFailedResponse'
'403':
description: Access is forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedFailedResponse'
'404':
description: The server cannot find the requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundFailedResponse'
'406':
description: Client Error
content:
application/json:
schema:
$ref: '#/components/schemas/NotAcceptableFailedResponse'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeviceStatus'
get:
operationId: deviceStatusDocument_search
summary: 'SEARCH: Search documents from the collection'
description: >-
General search operation through documents of one collection, matching
the specified filtering criteria. You can apply:
1) filtering - combining any number of filtering parameters
2) ordering - using `sort` or `sort$desc` parameter
3) paging - using `limit` and `skip` parameters
If successful, HTTP 200 code is returned with JSON array of matching documents as a response content (it may be empty).
This operation requires `read` permission for the API and the collection (e.g. `*:*:read`, `api:*:read`, `*:treatments:read`, `api:treatments:read`).
The only exception is the `settings` collection which requires `admin` permission (`api:settings:admin`), because the settings of each application should be isolated and kept secret. You need to know the concrete identifier to access the app's settings.
parameters:
- name: filter_parameters
in: query
required: true
schema:
type: string
- name: sort
in: query
required: true
schema:
type: string
- name: sort$desc
in: query
required: true
schema:
type: string
- name: limit
in: query
required: true
schema:
type: integer
format: int32
- name: skip
in: query
required: true
schema:
type: integer
format: int32
- name: fields
in: query
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
result:
type: array
items:
$ref: '#/components/schemas/DeviceStatus'
x-cadl-name: DeviceStatus[]
required:
- status
- result
x-cadl-name: OkCollectionResult<DeviceStatus>
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
'401':
description: Access is unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedFailedResponse'
'403':
description: Access is forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedFailedResponse'
'404':
description: The server cannot find the requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundFailedResponse'
'406':
description: Client Error
content:
application/json:
schema:
$ref: '#/components/schemas/NotAcceptableFailedResponse'
/v3/devicestatus/history:
get:
operationId: deviceStatusDocument_getCollectionHistory
summary: 'HISTORY: Retrieves incremental changes since dateTime in header'
description: >
HISTORY operation is intended for continuous data synchronization with
other systems.
Every insertion, update and deletion will be included in the resulting
JSON array of documents (since timestamp in `Last-Modified` request
header value). All changes are listed chronologically in response with
200 HTTP status code. The maximum listed `srvModified` timestamp is also
stored in `Last-Modified` and `ETag` response headers that you can use
for future, directly following synchronization. You can also limit the
array's length using `limit` parameter.
Deleted documents will appear with `isValid` = `false` field.
HISTORY operation has a fallback mechanism in place for documents, which
were not created by API v3. For such documents `srvModified` is
virtually assigned from the `date` field (for `entries` collection) or
from the `created_at` field (for other collections).
This operation requires `read` permission for the API and the collection
(e.g. `api:treatments:read`)
The only exception is the `settings` collection which requires `admin`
permission (`api:settings:admin`), because the settings of each
application should be isolated and kept secret. You need to know the
concrete identifier to access the app's settings.
parameters:
- name: Last-Modified
in: header
required: true
schema:
type: string
- name: limit
in: query
required: true
schema:
type: integer
format: int32
- name: fields
in: query
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
result:
type: array
items:
$ref: '#/components/schemas/DeviceStatus'
x-cadl-name: DeviceStatus[]
required:
- status
- result
x-cadl-name: OkCollectionResult<DeviceStatus>
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
/v3/devicestatus/history/{lastModified}:
get:
operationId: deviceStatusDocument_history2
summary: 'HISTORY: Retrieves incremental changes since timestamp in path'
parameters:
- name: lastModified
in: path
required: true
schema:
type: integer
format: int64
- name: limit
in: query
required: true
schema:
type: integer
format: int32
- name: fields
in: query
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
result:
type: array
items:
$ref: '#/components/schemas/DeviceStatus'
x-cadl-name: DeviceStatus[]
required:
- status
- result
x-cadl-name: OkCollectionResult<DeviceStatus>
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
/v3/devicestatus/{identifier}:
get:
operationId: deviceStatusDocument_read
summary: 'READ: Retrieves a single document from the collection'
description: >-
Basically this operation looks for a document matching the `identifier`
field returning 200 or 404 HTTP status code.
If the document has been found in the collection but it had already been
deleted, 410 HTTP status code is to be returned.
When `If-Modified-Since` header is used and its value is greater than
the timestamp of the document in the collection, 304 HTTP status code
with empty response content is returned. It means that the document has
not been modified on server since the last retrieval to client side.
With `If-Modified-Since` header and less or equal timestamp
`srvModified` a normal 200 HTTP status with full response is returned.
This operation requires `read` permission for the API and the collection
(e.g. `api:treatments:read`)
parameters:
- name: If-Modified-Since
in: header
required: true
schema:
type: string
- name: identifier
in: path
required: true
schema:
type: string
- name: fields
in: query
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
result:
$ref: '#/components/schemas/DeviceStatus'
required:
- status
- result
x-cadl-name: OkResult<DeviceStatus>
'304':
description: >-
The client has made a conditional request and the resource has not
been modified.
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
'401':
description: Access is unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedFailedResponse'
'404':
description: The server cannot find the requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundFailedResponse'
'406':
description: Client Error
content:
application/json:
schema:
$ref: '#/components/schemas/NotAcceptableFailedResponse'
'410':
description: Client Error
content:
application/json:
schema:
$ref: '#/components/schemas/GoneFailedResponse'
put:
operationId: deviceStatusDocument_update
summary: 'UPDATE: Updates a document in the collection'
description: >
Normally the document with the matching `identifier` will be replaced in
the collection by the whole JSON request body and 200 HTTP status code
will be returned.
If the document has been found in the collection but it had already been
deleted, 410 HTTP status code is to be returned.
When no document with `identifier` has been found in the collection,
then an insert operation takes place instead of updating. Finally 201
HTTP status code is returned with only `Last-Modified` header
(`identifier` is already known from the path parameter).
You can also specify `If-Unmodified-Since` request header including your
timestamp of document's last modification. If the document has been
modified by somebody else on the server afterwards (and you do not know
about it), the 412 HTTP status code is returned cancelling the update
operation. You can use this feature to prevent race condition problems.
This operation provides autopruning of the collection (if autopruning is
enabled).
This operation requires `update` (and/or `create`) permission for the
API and the collection (e.g. `api:treatments:update` and
`api:treatments:create`)
parameters:
- name: If-Modified-Since
in: header
required: true
schema:
type: string
- name: identifier
in: path
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/updatedDocument'
'201':
description: >-
The request has succeeded and a new resource has been created as a
result.
headers:
Location:
required: true
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/createdDocument'
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
'401':
description: Access is unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedFailedResponse'
'403':
description: Access is forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedFailedResponse'
'404':
description: The server cannot find the requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundFailedResponse'
'410':
description: Client Error
content:
application/json:
schema:
$ref: '#/components/schemas/GoneFailedResponse'
'412':
description: Precondition failed.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
required:
- status
x-cadl-name: StatusResponse<412>
'422':
description: Client Error
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
required:
- status
x-cadl-name: StatusResponse<422>
patch:
operationId: deviceStatusDocument_patch
summary: 'PATCH: Partially updates document in the collection'
description: >-
Normally the document with the matching `identifier` will be retrieved
from the collection and it will be patched by all specified fields from
the JSON request body. Finally 200 HTTP status code will be returned.
If the document has been found in the collection but it had already been
deleted, 410 HTTP status code is to be returned.
When no document with `identifier` has been found in the collection,
then the operation ends with 404 HTTP status code.
You can also specify `If-Unmodified-Since` request header including your
timestamp of document's last modification. If the document has been
modified by somebody else on the server afterwards (and you do not know
about it), the 412 HTTP status code is returned cancelling the update
operation. You can use this feature to prevent race condition problems.
`PATCH` operation can save some bandwidth for incremental document
updates in comparison with `GET` - `UPDATE` operation sequence.
While patching the document, the field `modifiedBy` is automatically set
to the authorized subject's name.
This operation provides autopruning of the collection (if autopruning is
enabled).
This operation requires `update` permission for the API and the
collection (e.g. `api:treatments:update`)
parameters:
- name: If-Modified-Since
in: header
required: true
schema:
type: string
- name: identifier
in: path
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/updatedDocument'
'201':
description: >-
The request has succeeded and a new resource has been created as a
result.
headers:
Location:
required: true
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/createdDocument'
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
'401':
description: Access is unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedFailedResponse'
'403':
description: Access is forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedFailedResponse'
'404':
description: The server cannot find the requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundFailedResponse'
'410':
description: Client Error
content:
application/json:
schema:
$ref: '#/components/schemas/GoneFailedResponse'
'412':
description: Precondition failed.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
required:
- status
x-cadl-name: StatusResponse<412>
'422':
description: Client Error
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
required:
- status
x-cadl-name: StatusResponse<422>
delete:
operationId: deviceStatusDocument_delete
summary: 'DELETE: Deletes a document from the collection'
description: >-
If the document has already been deleted, the operation will succeed
anyway. Normally, documents are not really deleted from the collection
but they are only marked as deleted. For special cases the deletion can
be irreversible using `permanent` parameter.
This operation provides autopruning of the collection (if autopruning is
enabled).
This operation requires `delete` permission for the API and the
collection (e.g. `api:treatments:delete`)
parameters:
- name: permanent
in: query
required: true
schema:
type: boolean
- name: identifier
in: path
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
result:
type: number
enum:
- 200
required:
- status
- result
x-cadl-name: OkResult<200>
'401':
description: Access is unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedFailedResponse'
'403':
description: Access is forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedFailedResponse'
'404':
description: The server cannot find the requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundFailedResponse'
'422':
description: Client Error
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
required:
- status
x-cadl-name: StatusResponse<422>
/v3/entries:
post:
operationId: entryDocument_create
summary: 'CREATE: Inserts a new document into the collection'
description: >-
Using this operation you can insert new documents into collection.
Normally the operation ends with 201 HTTP status code, `Last-Modified`
and `Location` headers specified.
`identifier` is included in response body or it can be parsed from the
`Location` response header.
When the document to post is marked as a duplicate (using rules
described at `API3_DEDUP_FALLBACK_ENABLED` switch), the update operation
takes place instead of inserting. In this case the original document in
the collection is found and it gets updated by the actual operation POST
body. Finally the operation ends with 200 HTTP status code along with
`Last-Modified` and correct `Location` headers. The response body then
includes `isDeduplication`=`true` and `deduplicatedIdentifier` fields.
This operation provides autopruning of the collection (if autopruning is
enabled).
This operation requires `create` (and/or `update` for deduplication)
permission for the API and the collection (e.g. `api:treatments:create`
and `api:treatments:update`)
parameters: []
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/updatedDocument'
'201':
description: >-
The request has succeeded and a new resource has been created as a
result.
headers:
Location:
required: true
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/createdDocument'
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
'401':
description: Access is unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedFailedResponse'
'403':
description: Access is forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedFailedResponse'
'404':
description: The server cannot find the requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundFailedResponse'
'406':
description: Client Error
content:
application/json:
schema:
$ref: '#/components/schemas/NotAcceptableFailedResponse'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Entry'
get:
operationId: entryDocument_search
summary: 'SEARCH: Search documents from the collection'
description: >-
General search operation through documents of one collection, matching
the specified filtering criteria. You can apply:
1) filtering - combining any number of filtering parameters
2) ordering - using `sort` or `sort$desc` parameter
3) paging - using `limit` and `skip` parameters
If successful, HTTP 200 code is returned with JSON array of matching documents as a response content (it may be empty).
This operation requires `read` permission for the API and the collection (e.g. `*:*:read`, `api:*:read`, `*:treatments:read`, `api:treatments:read`).
The only exception is the `settings` collection which requires `admin` permission (`api:settings:admin`), because the settings of each application should be isolated and kept secret. You need to know the concrete identifier to access the app's settings.
parameters:
- name: filter_parameters
in: query
required: true
schema:
type: string
- name: sort
in: query
required: true
schema:
type: string
- name: sort$desc
in: query
required: true
schema:
type: string
- name: limit
in: query
required: true
schema:
type: integer
format: int32
- name: skip
in: query
required: true
schema:
type: integer
format: int32
- name: fields
in: query
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int32
result:
type: array
items:
$ref: '#/components/schemas/Entry'
x-cadl-name: Entry[]
required:
- status
- result
x-cadl-name: OkCollectionResult<Entry>
'400':
description: The server could not understand the request due to invalid syntax.
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestFailedResponse'
'401':
description: Access is unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedFailedResponse'
'403':
description: Access is forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedFailedResponse'
'404':
description: The server cannot find the requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundFailedResponse'
'406':
description: Client Error
content:
application/json:
schema:
$ref: '#/components/schemas/NotAcceptableFailedResponse'
/v3/entries/history:
get:
operationId: entryDocument_getCollectionHistory
summary: 'HISTORY: Retrieves incremental changes since dateTime in header'
description: >
HISTORY operation is intended for continuous data synchronization with
other systems.
Every insertion, update and deletion will be included in the resulting
JSON array of documents (since timestamp in `Last-Modified` request
header value). All changes are listed chronologically in response with
200 HTTP status code. The maximum listed `srvModified` timestamp is also
stored in `Last-Modified` and `ETag` response headers that you can use
for future, directly following synchronization. You can also limit the
array's length using `limit` parameter.
Deleted documents will appear with `isValid` = `false` field.
HISTORY operation has a fallback mechanism in place for documents, which
were not created by API v3. For such documents `srvModified` is
virtually assigned from the `date` field (for `entries` collection) or
from the `created_at` field (for other collections).
This operation requires `read` permission for the API and the collection
(e.g. `api:treatments:read`)
The only exception is the `settings` collection which requires `admin`
permission (`api:settings:admin`), because the settings of each
application should be isolated and kept secret. You need to know the
concrete identifier to access the app's settings.
parameters:
- name: Last-Modified
in: header
required: true
schema:
type: string
- name: limit
in: query
required: true
schema:
type: integer
format: int32
- name: fields
in: query
required: true