-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi.json
More file actions
4124 lines (4124 loc) · 141 KB
/
Copy pathapi.json
File metadata and controls
4124 lines (4124 loc) · 141 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.0.3",
"info": {
"title": "eXist-db Platform API",
"version": "0.14.0",
"description": "Unified REST API for eXist-db: query execution, language services, database management, user management, package management, search, and cross-app linking.",
"license": {
"name": "LGPL-2.1",
"url": "https://opensource.org/licenses/LGPL-2.1"
}
},
"servers": [
{
"url": "/exist/apps/existdb-openapi",
"description": "Local eXist-db instance"
}
],
"tags": [
{
"name": "System",
"description": "System information, scheduler, and test runner"
},
{
"name": "Query",
"description": "XQuery execution with cursor-based result pagination"
},
{
"name": "Language Service",
"description": "Language services for XQuery (diagnostics, completions, hover, etc.). Data shapes are inspired by the Language Server Protocol but consumed over HTTP/JSON."
},
{
"name": "Database",
"description": "Database resource and collection management"
},
{
"name": "Users",
"description": "User account management"
},
{
"name": "Groups",
"description": "Group management"
},
{
"name": "Packages",
"description": "EXPath package management"
},
{
"name": "Search",
"description": "Sitewide full-text search"
},
{
"name": "Site",
"description": "Site-level app listing and cross-app link resolution"
}
],
"components": {
"securitySchemes": {
"basicAuth": {
"type": "http",
"scheme": "basic"
},
"cookieAuth": {
"type": "apiKey",
"in": "cookie",
"name": "org.exist.login"
}
},
"schemas": {
"Error": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message"
}
},
"required": [
"error"
],
"example": {
"error": "Resource not found: /db/nonexistent.xml"
}
},
"QueryError": {
"type": "object",
"description": "Structured error envelope for a failed query evaluation. `line`/`column` are 1-based and user-relative — the position in the submitted `query`, the same frame an editor uses — so a client can place an error marker without parsing prose.",
"properties": {
"code": {
"type": "string",
"description": "Error QName, e.g. `err:XPST0003`"
},
"message": {
"type": "string",
"description": "The human-readable reason, with eXist's framing removed (no W3C boilerplate, leaked Java class name, or `[at line …]` suffix)"
},
"line": {
"type": "integer",
"nullable": true,
"description": "1-based, user-relative line of the error in the submitted query; null when the error carries no position"
},
"column": {
"type": "integer",
"nullable": true,
"description": "1-based, user-relative column; null when the error carries no position"
},
"raw": {
"type": "string",
"description": "The unmodified `$err:description`, retained so no detail is lost"
}
},
"required": [
"code",
"message",
"raw"
],
"example": {
"code": "err:XPST0003",
"message": "unexpected token: null",
"line": 1,
"column": 5,
"raw": "It is a static error if an expression is not a valid instance of the grammar defined in A.1 EBNF. org.exist.xquery.XPathException: err:XPST0003 unexpected token: null [at line 1, column 5]"
}
}
}
},
"security": [
{
"basicAuth": []
},
{
"cookieAuth": []
}
],
"paths": {
"/api/system/info": {
"get": {
"summary": "Get system information",
"operationId": "system-api:info",
"description": "Returns database, Java, and OS information. No authentication required. Replaces xst's info.xq.",
"tags": [
"System"
],
"responses": {
"200": {
"description": "System information including database version, Java runtime, and operating system details",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"db": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"git": {
"type": "string"
}
}
},
"java": {
"type": "object",
"properties": {
"version": {
"type": "string"
},
"vendor": {
"type": "string"
}
}
},
"os": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"arch": {
"type": "string"
}
}
}
},
"example": {
"db": {
"name": "eXist",
"version": "7.0.0",
"git": "abc123"
},
"java": {
"version": "21.0.5",
"vendor": "Azul Systems, Inc."
},
"os": {
"name": "Mac OS X",
"version": "15.0",
"arch": "aarch64"
}
}
}
}
}
}
}
}
},
"/api/system/scheduler": {
"get": {
"summary": "List scheduled jobs",
"operationId": "system-api:scheduler",
"description": "Returns all scheduled jobs from the eXist-db scheduler. Used by Dashboard's System tab.",
"tags": [
"System"
],
"responses": {
"200": {
"description": "Scheduled jobs with trigger states and timing information",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"jobs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"group": {
"type": "string"
},
"triggerState": {
"type": "string"
},
"start": {
"type": "string"
},
"end": {
"type": "string"
},
"previous": {
"type": "string"
},
"next": {
"type": "string"
},
"expression": {
"type": "string"
}
}
}
}
},
"example": {
"jobs": [
{
"name": "Sessions.Check",
"group": "eXist.Security",
"triggerState": "NORMAL",
"start": "",
"end": "",
"previous": "2024-01-01T00:00:00",
"next": "2024-01-01T00:05:00",
"expression": "0 0/5 * * * ?"
}
]
}
}
}
}
}
}
}
},
"/api/test": {
"post": {
"summary": "Run XQSuite tests",
"operationId": "system-api:test",
"description": "Runs XQSuite tests on a stored XQuery module. Returns the test results as HTML.",
"tags": [
"System"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"source"
],
"properties": {
"source": {
"type": "string",
"description": "DB path to the XQSuite test module"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Test results with pass/fail counts and XML output",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "DB path of the test module"
},
"tests": {
"type": "integer",
"description": "Total number of tests"
},
"failures": {
"type": "integer",
"description": "Number of failed tests"
},
"errors": {
"type": "integer",
"description": "Number of tests with errors"
},
"pending": {
"type": "integer",
"description": "Number of pending tests"
},
"results": {
"type": "string",
"description": "XML test results (JUnit format)"
}
},
"example": {
"source": "/db/apps/myapp/test/suite.xql",
"tests": 12,
"failures": 0,
"errors": 0,
"pending": 1,
"results": "<testsuites>...</testsuites>"
}
}
}
}
},
"400": {
"description": "Bad request — missing or invalid source parameter",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Test module not found at the given path",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/query": {
"post": {
"summary": "Execute query and return cursor",
"operationId": "query:execute",
"description": "Compiles and evaluates an XQuery expression, returning a cursor ID for paginated result retrieval. The cursor must be closed when no longer needed.",
"tags": [
"Query"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"query"
],
"properties": {
"query": {
"type": "string",
"description": "XQuery expression to evaluate"
},
"module-load-path": {
"type": "string",
"description": "Module load path for resolving imports"
},
"context-item": {
"type": "string",
"description": "Serialized XML to use as the context item — the node `expression` will see as `.` / the focus of unprefixed path expressions like `//foo`. Use when the editor has unsaved buffer content not yet stored in the database. Ignored when `context-path` is also supplied."
},
"context-path": {
"type": "string",
"description": "DB path (e.g. `/db/apps/foo/data.xml`) to a document to use as the context item. Convenience shortcut over `context-item` when the editor's current document is already in the database. Takes precedence over `context-item`."
},
"variables": {
"type": "object",
"additionalProperties": true,
"description": "External-variable bindings: each property name is a variable's local name (no namespace), bound to the matching `declare variable $name external;` in the expression. JSON values map to XDM by kind — string→xs:string, number→xs:double, boolean→xs:boolean, array→array(*), object→map(*) — so an array value is read with array accessors (e.g. `$x?*`, or `array:flatten($x)` for its members). A typed external declaration (e.g. `as xs:integer`) is matched strictly: pass a conforming value or cast in-query (`xs:integer($n)`). A name with no matching external declaration is ignored, as eXist's own XML-RPC and REST query interfaces do.",
"example": {
"project-id": "frus1981-88v36",
"div-ids": ["d278", "d300"]
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Query executed successfully; returns a cursor for result retrieval",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"cursor": {
"type": "string",
"description": "Unique cursor ID for fetching results"
},
"items": {
"type": "integer",
"description": "Total number of result items"
},
"elapsed": {
"type": "integer",
"description": "Total elapsed time in milliseconds"
},
"timing": {
"type": "object",
"properties": {
"compile": {
"type": "integer",
"description": "Compilation time in ms"
},
"evaluate": {
"type": "integer",
"description": "Evaluation time in ms"
},
"total": {
"type": "integer",
"description": "Total time in ms"
}
}
}
},
"example": {
"cursor": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"items": 10,
"elapsed": 5,
"timing": {
"compile": 2,
"evaluate": 3,
"total": 5
}
}
}
}
}
},
"400": {
"description": "Bad request. Either a request-validation error (missing `query` field or malformed `context-item` XML) with an `{ error }` body, or — when the submitted query itself fails to compile or evaluate (a standard XPath/XQuery error) — a structured `QueryError` body with user-relative `line`/`column`.",
"content": {
"application/json": {
"schema": {
"oneOf": [
{ "$ref": "#/components/schemas/Error" },
{ "$ref": "#/components/schemas/QueryError" }
]
}
}
}
},
"404": {
"description": "`context-path` was supplied but the document at that path doesn't exist",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"500": {
"description": "Internal failure during query compilation or evaluation (an error outside the standard XPath/XQuery `err:` namespace). Body is a structured `QueryError` so clients can surface the real cause.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryError"
}
}
}
}
}
}
},
"/api/query/{id}/results": {
"get": {
"summary": "Fetch page of results from cursor",
"operationId": "query:fetch",
"description": "Retrieves a page of serialized results from an open query cursor. Supports configurable start position, count, serialization method, and indentation.",
"tags": [
"Query"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "Cursor ID returned by POST /api/query"
},
{
"name": "start",
"in": "query",
"schema": {
"type": "integer",
"default": 1
},
"description": "1-based start position"
},
{
"name": "count",
"in": "query",
"schema": {
"type": "integer",
"default": 10
},
"description": "Number of items to return"
},
{
"name": "method",
"in": "query",
"schema": {
"type": "string",
"default": "adaptive"
},
"description": "Serialization method (adaptive, xml, json, text)"
},
{
"name": "indent",
"in": "query",
"schema": {
"type": "string",
"default": "yes"
},
"description": "Whether to indent output (yes/no)"
}
],
"responses": {
"200": {
"description": "Array of serialized result items with type information",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"description": "Serialized value"
},
"type": {
"type": "string",
"description": "XDM type (e.g. xs:integer, element())"
},
"documentURI": {
"type": "string",
"description": "Source document URI if applicable"
},
"nodeId": {
"type": "string",
"description": "Internal node ID if applicable"
}
}
},
"example": [
{
"value": "1",
"type": "xs:integer",
"documentURI": "",
"nodeId": ""
}
]
}
}
}
},
"404": {
"description": "Cursor not found or expired",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/query/{id}": {
"delete": {
"summary": "Close cursor and release resources",
"operationId": "query:close",
"description": "Closes an open query cursor and releases associated server-side resources. Should be called when the client is done fetching results.",
"tags": [
"Query"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "Cursor ID to close"
}
],
"responses": {
"200": {
"description": "Cursor successfully closed",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"closed": {
"type": "boolean",
"description": "Always true on success"
}
},
"example": {
"closed": true
}
}
}
}
},
"404": {
"description": "Cursor not found or already closed",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/query/{id}/cancel": {
"post": {
"summary": "Cancel running query",
"operationId": "query:cancel",
"description": "Attempts to cancel a currently running query. Not yet implemented — returns an error message.",
"tags": [
"Query"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "Cursor ID of the running query"
}
],
"responses": {
"200": {
"description": "Cancel result (currently returns not-implemented error)",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
},
"example": {
"error": "Not yet implemented"
}
}
}
}
}
}
}
},
"/api/langservice/diagnostics": {
"post": {
"summary": "Compile check",
"operationId": "langservice:diagnostics",
"description": "Compiles an XQuery expression and returns any syntax or static errors as diagnostics. Used by IDE integrations for real-time error checking.",
"tags": [
"Language Service"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"expression"
],
"properties": {
"expression": {
"type": "string",
"description": "XQuery expression to check"
},
"module-load-path": {
"type": "string",
"description": "Module load path for resolving imports"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Array of diagnostic entries (empty if no errors)",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"line": {
"type": "integer",
"description": "0-based line number"
},
"column": {
"type": "integer",
"description": "0-based column number"
},
"severity": {
"type": "integer",
"description": "Severity level (1=error, 2=warning, 3=info, 4=hint)"
},
"code": {
"type": "string",
"description": "XQuery error code (e.g. XPST0003)"
},
"message": {
"type": "string",
"description": "Human-readable error message"
}
}
},
"example": [
{
"line": 0,
"column": 5,
"severity": 1,
"code": "XPST0003",
"message": "unexpected token"
}
]
}
}
}
}
}
}
},
"/api/langservice/completions": {
"post": {
"summary": "Code completions",
"operationId": "langservice:completions",
"description": "Returns completion suggestions for an XQuery expression at the current cursor position. Includes functions, variables, and namespace prefixes.",
"tags": [
"Language Service"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"expression"
],
"properties": {
"expression": {
"type": "string",
"description": "XQuery expression up to the cursor"
},
"module-load-path": {
"type": "string",
"description": "Module load path for resolving imports"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Array of completion items",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"label": {
"type": "string",
"description": "Display label (e.g. fn:count#1)"
},
"kind": {
"type": "integer",
"description": "Completion kind (LSP CompletionItemKind)"
},
"detail": {
"type": "string",
"description": "Function signature or type info"
},
"documentation": {
"type": "string",
"description": "Documentation string"
},
"insertText": {
"type": "string",
"description": "Text to insert on accept"
}
}
},
"example": [
{
"label": "fn:count#1",
"kind": 3,
"detail": "fn:count($arg as item()*) as xs:integer",
"documentation": "Returns the number of items in a sequence",
"insertText": "fn:count()"
}
]
}
}
}
}
}
}
},
"/api/langservice/hover": {
"post": {
"summary": "Hover info",
"operationId": "langservice:hover",
"description": "Returns hover information (signature and documentation) for the symbol at the given line and column in the XQuery expression.",
"tags": [
"Language Service"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"expression",
"line",
"column"
],
"properties": {
"expression": {
"type": "string",
"description": "Full XQuery expression"
},
"line": {
"type": "integer",
"description": "0-based line number"
},
"column": {
"type": "integer",
"description": "0-based column number"
},
"module-load-path": {
"type": "string",
"description": "Module load path for resolving imports"
}
}
}
}
}
},
"responses": {
"200": {
"description": "LSP-shaped Hover: a map with one key, `contents`, whose value is a MarkupContent ({kind, value}) carrying Markdown-formatted documentation. Returns `null` (HTTP 200) if no symbol is found at the position.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"contents": {
"type": "object",
"description": "LSP MarkupContent — see the `MarkupContent` schema component.",
"properties": {
"kind": {
"type": "string",
"enum": ["markdown", "plaintext"],
"description": "Format of the `value` string."
},
"value": {
"type": "string",
"description": "The Markdown (or plaintext) body. For functions: a fenced XQuery code block with the signature, the description, a Parameters bullet list, and a Returns line."
}
}
}
},
"example": {
"contents": {
"kind": "markdown",
"value": "```xquery\ncount($items as item()*) as xs:integer\n```\n\nReturns the number of items in the argument sequence.\n\n**Parameters**\n\n- `$items` (`item()*`) — The items\n\n**Returns:** `xs:integer`"
}
}
}
}
}
}
}
}
},
"/api/langservice/signature-help": {
"post": {
"summary": "Parameter help inside a function call",
"operationId": "langservice:signature-help",
"description": "Returns LSP-shaped SignatureHelp for the function call surrounding the cursor: the call's signature, each parameter's label and per-parameter Markdown docs, plus an `activeParameter` index computed by counting commas at the call's paren depth. Returns `null` if the cursor is not inside a function-call argument list.",
"tags": [
"Language Service"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"expression",
"line",
"column"
],
"properties": {
"expression": {
"type": "string",
"description": "Full XQuery expression"
},
"line": {
"type": "integer",
"description": "0-based line number"
},
"column": {
"type": "integer",
"description": "0-based column number"
},
"module-load-path": {
"type": "string",
"description": "Module load path for resolving imports"
}
}
}
}
}
},
"responses": {
"200": {
"description": "LSP-shaped SignatureHelp, or `null` (HTTP 200) if the cursor is not inside a function call.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {