forked from MarkusPfundstein/mcp-obsidian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
1573 lines (1431 loc) · 52.6 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
components:
schemas:
Error:
properties:
errorCode:
description: |
A 5-digit error code uniquely identifying this particular type of error.
example: 40149
type: "number"
message:
description: "Message describing the error."
example: "A brief description of the error."
type: "string"
type: "object"
NoteJson:
properties:
content:
type: "string"
frontmatter:
type: "object"
path:
type: "string"
stat:
properties:
ctime:
type: "number"
mtime:
type: "number"
size:
type: "number"
required:
- "ctime"
- "mtime"
- "size"
type: "object"
tags:
items:
type: "string"
type: "array"
required:
- "tags"
- "frontmatter"
- "stat"
- "path"
- "content"
type: "object"
securitySchemes:
apiKeyAuth:
description: |
Find your API Key in your Obsidian settings
in the "Local REST API" section under "Plugins".
scheme: "bearer"
type: "http"
info:
description: |
You can use this interface for trying out your Local REST API in Obsidian.
Before trying the below tools, you will want to make sure you press the "Authorize" button below and provide the API Key you are shown when you open the "Local REST API" section of your Obsidian settings. All requests to the API require a valid API Key; so you won't get very far without doing that.
When using this tool you may see browser security warnings due to your browser not trusting the self-signed certificate the plugin will generate on its first run. If you do, you can make those errors disappear by adding the certificate as a "Trusted Certificate" in your browser or operating system's settings.
title: "Local REST API for Obsidian"
version: "1.0"
openapi: "3.0.2"
paths:
/:
get:
description: |
Returns basic details about the server as well as your authentication status.
This is the only API request that does *not* require authentication.
responses:
"200":
content:
application/json:
schema:
properties:
authenticated:
description: "Is your current request authenticated?"
type: "boolean"
ok:
description: "'OK'"
type: "string"
service:
description: "'Obsidian Local REST API'"
type: "string"
versions:
properties:
obsidian:
description: "Obsidian plugin API version"
type: "string"
self:
description: "Plugin version."
type: "string"
type: "object"
type: "object"
description: "Success"
summary: |
Returns basic details about the server.
tags:
- "Status"
/active/:
delete:
parameters: []
responses:
"204":
description: "Success"
"404":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "File does not exist."
"405":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Your path references a directory instead of a file; this request method is valid only for updating files.
summary: |
Deletes the currently-active file in Obsidian.
tags:
- "Active File"
get:
description: |
Returns the content of the currently active file in Obsidian.
If you specify the header `Accept: application/vnd.olrapi.note+json`, will return a JSON representation of your note including parsed tag and frontmatter data as well as filesystem metadata. See "responses" below for details.
parameters: []
responses:
"200":
content:
"application/vnd.olrapi.note+json":
schema:
"$ref": "#/components/schemas/NoteJson"
text/markdown:
schema:
example: |
# This is my document
something else here
type: "string"
description: "Success"
"404":
description: "File does not exist"
summary: |
Return the content of the active file open in Obsidian.
tags:
- "Active File"
patch:
description: |
Inserts content into the currently-open note relative to a heading within that note.
Allows you to modify the content relative to a heading, block reference, or frontmatter field in your document.
Note that this API was changed in Version 3.0 of this extension and the earlier PATCH API is now deprecated. Requests made using the previous version of this API will continue to work until Version 4.0 is released. See https://github.com/coddingtonbear/obsidian-local-rest-api/wiki/Changes-to-PATCH-requests-between-versions-2.0-and-3.0 for more details and migration instructions.
# Examples
All of the below examples assume you have a document that looks like
this:
```markdown
---
alpha: 1
beta: test
delta:
zeta: 1
yotta: 1
gamma:
- one
- two
---
# Heading 1
This is the content for heading one
Also references some [[#^484ef2]]
## Subheading 1:1
Content for Subheading 1:1
### Subsubheading 1:1:1
### Subsubheading 1:1:2
Testing how block references work for a table.[[#^2c7cfa]]
Some content for Subsubheading 1:1:2
More random text.
^2d9b4a
## Subheading 1:2
Content for Subheading 1:2.
some content with a block reference ^484ef2
## Subheading 1:3
| City | Population |
| ------------ | ---------- |
| Seattle, WA | 8 |
| Portland, OR | 4 |
^2c7cfa
```
## Append Content Below a Heading
If you wanted to append the content "Hello" below "Subheading 1:1:1" under "Heading 1",
you could send a request with the following headers:
- `Operation`: `append`
- `Target-Type`: `heading`
- `Target`: `Heading 1::Subheading 1:1:1`
- with the request body: `Hello`
The above would work just fine for `prepend` or `replace`, too, of course,
but with different results.
## Append Content to a Block Reference
If you wanted to append the content "Hello" below the block referenced by
"2d9b4a" above ("More random text."), you could send the following headers:
- `Operation`: `append`
- `Target-Type`: `block`
- `Target`: `2d9b4a`
- with the request body: `Hello`
The above would work just fine for `prepend` or `replace`, too, of course,
but with different results.
## Add a Row to a Table Referenced by a Block Reference
If you wanted to add a new city ("Chicago, IL") and population ("16") pair to the table above
referenced by the block reference `2c7cfa`, you could send the following
headers:
- `Operation`: `append`
- `TargetType`: `block`
- `Target`: `2c7cfa`
- `Content-Type`: `application/json`
- with the request body: `[["Chicago, IL", "16"]]`
The use of a `Content-Type` of `application/json` allows the API
to infer that member of your array represents rows and columns of your
to append to the referenced table. You can of course just use a
`Content-Type` of `text/markdown`, but in such a case you'll have to
format your table row manually instead of letting the library figure
it out for you.
You also have the option of using `prepend` (in which case, your new
row would be the first -- right below the table heading) or `replace` (in which
case all rows except the table heading would be replaced by the new row(s)
you supplied).
## Setting a Frontmatter Field
If you wanted to set the frontmatter field `alpha` to `2`, you could
send the following headers:
- `Operation`: `replace`
- `TargetType`: `frontmatter`
- `Target`: `beep`
- with the request body `2`
If you're setting a frontmatter field that might not already exist
you may want to use the `Create-Target-If-Missing` header so the
new frontmatter field is created and set to your specified value
if it doesn't already exist.
You may find using a `Content-Type` of `application/json` to be
particularly useful in the case of frontmatter since frontmatter
fields' values are JSON data, and the API can be smarter about
interpreting your `prepend` or `append` requests if you specify
your data as JSON (particularly when appending, for example,
list items).
parameters:
- description: "Patch operation to perform"
in: "header"
name: "Operation"
required: true
schema:
enum:
- "append"
- "prepend"
- "replace"
type: "string"
- description: "Type of target to patch"
in: "header"
name: "Target-Type"
required: true
schema:
enum:
- "heading"
- "block"
- "frontmatter"
type: "string"
- description: "Delimiter to use for nested targets (i.e. Headings)"
in: "header"
name: "Target-Delimiter"
required: false
schema:
default: "::"
type: "string"
- description: |
Target to patch; this value can be URL-Encoded and *must*
be URL-Encoded if it includes non-ASCII characters.
in: "header"
name: "Target"
required: true
schema:
type: "string"
- description: "Trim whitespace from Target before applying patch?"
in: "header"
name: "Trim-Target-Whitespace"
required: false
schema:
default: "false"
enum:
- "true"
- "false"
type: "string"
requestBody:
content:
application/json:
schema:
example: "['one', 'two']"
type: "string"
text/markdown:
schema:
example: |
# This is my document
something else here
type: "string"
description: "Content you would like to insert."
required: true
responses:
"200":
description: "Success"
"400":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "Bad Request; see response message for details."
"404":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "Does not exist"
"405":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Your path references a directory instead of a file; this request method is valid only for updating files.
summary: |
Insert content into the currently open note in Obsidian relative to a heading within that document.
tags:
- "Active File"
post:
description: |
Appends content to the end of the currently-open note.
If you would like to insert text relative to a particular heading instead of appending to the end of the file, see 'patch'.
parameters: []
requestBody:
content:
text/markdown:
schema:
example: |
# This is my document
something else here
type: "string"
description: "Content you would like to append."
required: true
responses:
"204":
description: "Success"
"400":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "Bad Request"
"405":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Your path references a directory instead of a file; this request method is valid only for updating files.
summary: |
Append content to the active file open in Obsidian.
tags:
- "Active File"
put:
requestBody:
content:
"*/*":
schema:
type: "string"
text/markdown:
schema:
example: |
# This is my document
something else here
type: "string"
description: "Content of the file you would like to upload."
required: true
responses:
"204":
description: "Success"
"400":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Incoming file could not be processed. Make sure you have specified a reasonable file name, and make sure you have set a reasonable 'Content-Type' header; if you are uploading a note, 'text/markdown' is likely the right choice.
"405":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Your path references a directory instead of a file; this request method is valid only for updating files.
summary: |
Update the content of the active file open in Obsidian.
tags:
- "Active File"
/commands/:
get:
responses:
"200":
content:
application/json:
example:
commands:
- id: "global-search:open"
name: "Search: Search in all files"
- id: "graph:open"
name: "Graph view: Open graph view"
schema:
properties:
commands:
items:
properties:
id:
type: "string"
name:
type: "string"
type: "object"
type: "array"
type: "object"
description: "A list of available commands."
summary: |
Get a list of available commands.
tags:
- "Commands"
"/commands/{commandId}/":
post:
parameters:
- description: "The id of the command to execute"
in: "path"
name: "commandId"
required: true
schema:
type: "string"
responses:
"204":
description: "Success"
"404":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "The command you specified does not exist."
summary: |
Execute a command.
tags:
- "Commands"
"/open/{filename}":
post:
description: |
Opens the specified document in Obsidian.
Note: Obsidian will create a new document at the path you have
specified if such a document did not already exist.
parameters:
- description: |
Path to the file to return (relative to your vault root).
in: "path"
name: "filename"
required: true
schema:
format: "path"
type: "string"
- description: "Open this as a new leaf?"
in: "query"
name: "newLeaf"
required: false
schema:
type: "boolean"
responses:
"200":
description: "Success"
summary: |
Open the specified document in Obsidian
tags:
- "Open"
"/periodic/{period}/":
delete:
description: |
Deletes the periodic note for the specified period.
parameters:
- description: "The name of the period for which you would like to grab the current note."
in: "path"
name: "period"
required: true
schema:
default: "daily"
enum:
- "daily"
- "weekly"
- "monthly"
- "quarterly"
- "yearly"
type: "string"
responses:
"204":
description: "Success"
"404":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "File does not exist."
"405":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Your path references a directory instead of a file; this request method is valid only for updating files.
summary: |
Delete a periodic note.
tags:
- "Periodic Notes"
get:
parameters:
- description: "The name of the period for which you would like to grab the current note."
in: "path"
name: "period"
required: true
schema:
default: "daily"
enum:
- "daily"
- "weekly"
- "monthly"
- "quarterly"
- "yearly"
type: "string"
responses:
"200":
content:
"application/vnd.olrapi.note+json":
schema:
"$ref": "#/components/schemas/NoteJson"
text/markdown:
schema:
example: |
# This is my document
something else here
type: "string"
description: "Success"
"404":
description: "File does not exist"
summary: |
Get current periodic note for the specified period.
tags:
- "Periodic Notes"
patch:
description: |
Inserts content into an existing note relative to a heading within your note.
Allows you to modify the content relative to a heading, block reference, or frontmatter field in your document.
Note that this API was changed in Version 3.0 of this extension and the earlier PATCH API is now deprecated. Requests made using the previous version of this API will continue to work until Version 4.0 is released. See https://github.com/coddingtonbear/obsidian-local-rest-api/wiki/Changes-to-PATCH-requests-between-versions-2.0-and-3.0 for more details and migration instructions.
# Examples
All of the below examples assume you have a document that looks like
this:
```markdown
---
alpha: 1
beta: test
delta:
zeta: 1
yotta: 1
gamma:
- one
- two
---
# Heading 1
This is the content for heading one
Also references some [[#^484ef2]]
## Subheading 1:1
Content for Subheading 1:1
### Subsubheading 1:1:1
### Subsubheading 1:1:2
Testing how block references work for a table.[[#^2c7cfa]]
Some content for Subsubheading 1:1:2
More random text.
^2d9b4a
## Subheading 1:2
Content for Subheading 1:2.
some content with a block reference ^484ef2
## Subheading 1:3
| City | Population |
| ------------ | ---------- |
| Seattle, WA | 8 |
| Portland, OR | 4 |
^2c7cfa
```
## Append Content Below a Heading
If you wanted to append the content "Hello" below "Subheading 1:1:1" under "Heading 1",
you could send a request with the following headers:
- `Operation`: `append`
- `Target-Type`: `heading`
- `Target`: `Heading 1::Subheading 1:1:1`
- with the request body: `Hello`
The above would work just fine for `prepend` or `replace`, too, of course,
but with different results.
## Append Content to a Block Reference
If you wanted to append the content "Hello" below the block referenced by
"2d9b4a" above ("More random text."), you could send the following headers:
- `Operation`: `append`
- `Target-Type`: `block`
- `Target`: `2d9b4a`
- with the request body: `Hello`
The above would work just fine for `prepend` or `replace`, too, of course,
but with different results.
## Add a Row to a Table Referenced by a Block Reference
If you wanted to add a new city ("Chicago, IL") and population ("16") pair to the table above
referenced by the block reference `2c7cfa`, you could send the following
headers:
- `Operation`: `append`
- `TargetType`: `block`
- `Target`: `2c7cfa`
- `Content-Type`: `application/json`
- with the request body: `[["Chicago, IL", "16"]]`
The use of a `Content-Type` of `application/json` allows the API
to infer that member of your array represents rows and columns of your
to append to the referenced table. You can of course just use a
`Content-Type` of `text/markdown`, but in such a case you'll have to
format your table row manually instead of letting the library figure
it out for you.
You also have the option of using `prepend` (in which case, your new
row would be the first -- right below the table heading) or `replace` (in which
case all rows except the table heading would be replaced by the new row(s)
you supplied).
## Setting a Frontmatter Field
If you wanted to set the frontmatter field `alpha` to `2`, you could
send the following headers:
- `Operation`: `replace`
- `TargetType`: `frontmatter`
- `Target`: `beep`
- with the request body `2`
If you're setting a frontmatter field that might not already exist
you may want to use the `Create-Target-If-Missing` header so the
new frontmatter field is created and set to your specified value
if it doesn't already exist.
You may find using a `Content-Type` of `application/json` to be
particularly useful in the case of frontmatter since frontmatter
fields' values are JSON data, and the API can be smarter about
interpreting your `prepend` or `append` requests if you specify
your data as JSON (particularly when appending, for example,
list items).
parameters:
- description: "Patch operation to perform"
in: "header"
name: "Operation"
required: true
schema:
enum:
- "append"
- "prepend"
- "replace"
type: "string"
- description: "Type of target to patch"
in: "header"
name: "Target-Type"
required: true
schema:
enum:
- "heading"
- "block"
- "frontmatter"
type: "string"
- description: "Delimiter to use for nested targets (i.e. Headings)"
in: "header"
name: "Target-Delimiter"
required: false
schema:
default: "::"
type: "string"
- description: |
Target to patch; this value can be URL-Encoded and *must*
be URL-Encoded if it includes non-ASCII characters.
in: "header"
name: "Target"
required: true
schema:
type: "string"
- description: "Trim whitespace from Target before applying patch?"
in: "header"
name: "Trim-Target-Whitespace"
required: false
schema:
default: "false"
enum:
- "true"
- "false"
type: "string"
- description: "The name of the period for which you would like to grab the current note."
in: "path"
name: "period"
required: true
schema:
default: "daily"
enum:
- "daily"
- "weekly"
- "monthly"
- "quarterly"
- "yearly"
type: "string"
requestBody:
content:
application/json:
schema:
example: "['one', 'two']"
type: "string"
text/markdown:
schema:
example: |
# This is my document
something else here
type: "string"
description: "Content you would like to insert."
required: true
responses:
"200":
description: "Success"
"400":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "Bad Request; see response message for details."
"404":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "Does not exist"
"405":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Your path references a directory instead of a file; this request method is valid only for updating files.
summary: |
Insert content into a periodic note relative to a heading within that document.
tags:
- "Periodic Notes"
post:
description: |
Appends content to the periodic note for the specified period. This will create the relevant periodic note if necessary.
parameters:
- description: "The name of the period for which you would like to grab the current note."
in: "path"
name: "period"
required: true
schema:
default: "daily"
enum:
- "daily"
- "weekly"
- "monthly"
- "quarterly"
- "yearly"
type: "string"
requestBody:
content:
text/markdown:
schema:
example: |
# This is my document
something else here
type: "string"
description: "Content you would like to append."
required: true
responses:
"204":
description: "Success"
"400":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: "Bad Request"
"405":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Your path references a directory instead of a file; this request method is valid only for updating files.
summary: |
Append content to a periodic note.
tags:
- "Periodic Notes"
put:
parameters:
- description: "The name of the period for which you would like to grab the current note."
in: "path"
name: "period"
required: true
schema:
default: "daily"
enum:
- "daily"
- "weekly"
- "monthly"
- "quarterly"
- "yearly"
type: "string"
requestBody:
content:
"*/*":
schema:
type: "string"
text/markdown:
schema:
example: |
# This is my document
something else here
type: "string"
description: "Content of the file you would like to upload."
required: true
responses:
"204":
description: "Success"
"400":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Incoming file could not be processed. Make sure you have specified a reasonable file name, and make sure you have set a reasonable 'Content-Type' header; if you are uploading a note, 'text/markdown' is likely the right choice.
"405":
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
description: |
Your path references a directory instead of a file; this request method is valid only for updating files.
summary: |
Update the content of a periodic note.
tags:
- "Periodic Notes"
/search/:
post:
description: |
Evaluates a provided query against each file in your vault.
This endpoint supports multiple query formats. Your query should be specified in your request's body, and will be interpreted according to the `Content-type` header you specify from the below options.Additional query formats may be added in the future.
# Dataview DQL (`application/vnd.olrapi.dataview.dql+txt`)
Accepts a `TABLE`-type Dataview query as a text string. See [Dataview](https://blacksmithgu.github.io/obsidian-dataview/query/queries/)'s query documentation for information on how to construct a query.
# JsonLogic (`application/vnd.olrapi.jsonlogic+json`)
Accepts a JsonLogic query specified as JSON. See [JsonLogic](https://jsonlogic.com/operations.html)'s documentation for information about the base set of operators available, but in addition to those operators the following operators are available:
- `glob: [PATTERN, VALUE]`: Returns `true` if a string matches a glob pattern. E.g.: `{"glob": ["*.foo", "bar.foo"]}` is `true` and `{"glob": ["*.bar", "bar.foo"]}` is `false`.
- `regexp: [PATTERN, VALUE]`: Returns `true` if a string matches a regular expression. E.g.: `{"regexp": [".*\.foo", "bar.foo"]` is `true` and `{"regexp": [".*\.bar", "bar.foo"]}` is `false`.
Returns only non-falsy results. "Non-falsy" here treats the following values as "falsy":
- `false`
- `null` or `undefined`
- `0`
- `[]`
- `{}`
Files are represented as an object having the schema described
in the Schema named 'NoteJson' at the bottom of this page.
Understanding the shape of a JSON object from a schema can be
tricky; so you may find it helpful to examine the generated metadata
for individual files in your vault to understand exactly what values
are returned. To see that, access the `GET` `/vault/{filePath}`
route setting the header:
`Accept: application/vnd.olrapi.note+json`. See examples below
for working examples of queries performing common search operations.
requestBody:
content:
"application/vnd.olrapi.dataview.dql+txt":
examples:
find_fields_by_tag:
summary: "List data from files having the #game tag."
value: |
TABLE
time-played AS "Time Played",
length AS "Length",
rating AS "Rating"
FROM #game
SORT rating DESC
schema:
externalDocs:
url: "https://blacksmithgu.github.io/obsidian-dataview/query/queries/"
type: "object"
"application/vnd.olrapi.jsonlogic+json":
examples:
find_by_frontmatter_url_glob:
summary: "Find notes having URL or a matching URL glob frontmatter field."
value: |
{
"or": [
{"===": [{"var": "frontmatter.url"}, "https://myurl.com/some/path/"]},
{"glob": [{"var": "frontmatter.url-glob"}, "https://myurl.com/some/path/"]}
]
}
find_by_frontmatter_value:
summary: "Find notes having a certain frontmatter field value."
value: |
{
"==": [
{"var": "frontmatter.myField"},
"myValue"
]
}
find_by_tag:
summary: "Find notes having a certain tag"
value: |
{
"in": [
"myTag",