-
Notifications
You must be signed in to change notification settings - Fork 154
Changes to PATCH requests between versions 2.0 and 3.0
This API was changed in version 3.0 of Obsidian Local REST API to support making changes to your document relative to "block references" and frontmatter fields in addition to headings within your document.
Version 2.0 of this API (now undocumented) is still accessible as
long as your incoming request specifies the Heading
header and
does not specify a Target-Type
header. You should upgrade
to the current version of the API as soon as possible. Support for the Version 2.0 API is
now deprecated and no longer be available in Version 4.0.
You can migrate to the current version of the API by following the below guidelines. The words "heading" and "header" both occur quite a lot in the below paragraphs so it may aid in your understanding if you keep in mind that "heading" here refers to a heading existing within your markdown document and "header" refers to an HTTP Header that you may set to a value as part of using this API.
- Rename your
Heading
header toTarget
. - Add a new
Target-Type
header having the valueheading
. - Set the
Operation
header such that its value isappend
if you had either not set theContent-Insertion-Position
header or had set it toend
. Set it toprepend
if you had setContent-Insertion-Position
tobeginning
. - If you had set
Content-Insertion-Ignore-Newline
totrue
, set theTrim-Target-Whitespace
header value totrue
also.
Aside from the above, there is one important thing to keep in mind: while the obsolete version of this API allowed you to specify just the terminal heading (e.g. content under ### My Heading
could be addressed by setting the Heading
header to My Heading
), the current version of this API requires that you provide the full path to your target heading (i.e. instead of My Heading
, you must find the parent second level heading and and its parent top level heading) delimited by ::
. If ::
appears in your heading, you can override that value by setting the Target-Delimiter
header.
For example, if you had previously set Heading
to My Heading
for adding content to "MY CONTENT" in a document like:
# Some top-level heading
## Some second-level heading
### My Heading
MY CONTENT
you should now set your Target
heading to Some top-level heading::Some second-level heading::My Heading
.