Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
docs(user): exporting a ZIP using curl & ETAPI (closes #4958)
Elian Doran985a54edd1b6
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/ETAPI (REST API).html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/ETAPI (REST API).htmlindex a9ae4e829a..2f9048e33b 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/ETAPI (REST API).html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/ETAPI (REST API).html@@ -5,7 +5,7 @@<p>As an alternative to calling the API directly, there are client librariesto simplify this</p><ul>- <li><a href="https://github.com/Nriver/trilium-py">trilium-py</a>, you can+ <li data-list-item-id="ee7b0cc154e457f4bd579cec38dd49695"><a href="https://github.com/Nriver/trilium-py">trilium-py</a>, you canuse Python to communicate with Trilium.</li></ul><h2>Obtaining a token</h2>@@ -23,10 +23,10 @@ Authorization: ETAPITOKEN</code></pre><p>Since v0.56 you can also use basic auth format:</p><pre><code class="language-text-x-trilium-auto">GET https://myserver.com/etapi/app-infoAuthorization: Basic BATOKEN</code></pre><ul>- <li>Where <code>BATOKEN = BASE64(username + ':' + password)</code> - this is+ <li data-list-item-id="e86aabb1609179bc22edcb308bb84ebf8">Where <code>BATOKEN = BASE64(username + ':' + password)</code> - this isa standard Basic Auth serialization</li>- <li>Where <code>username</code> is "etapi"</li>- <li>And <code>password</code> is the generated ETAPI token described above.</li>+ <li data-list-item-id="e5837f08379443a09a7ea8a4237bf2909">Where <code>username</code> is "etapi"</li>+ <li data-list-item-id="e137dc99a1b1c5a308bc5dc4b450cadda">And <code>password</code> is the generated ETAPI token described above.</li></ul><p>Basic Auth is meant to be used with tools which support only basic auth.</p><h2>Interaction using Bash scripts</h2>@@ -42,8 +42,14 @@ NOTE_ID="i6ra4ZshJhgN"curl "$SERVER/etapi/notes/$NOTE_ID/content" -H "Authorization: $TOKEN" </code></pre><p>Make sure to replace the values of:</p><ul>- <li><code>TOKEN</code> with your ETAPI token.</li>- <li><code>SERVER</code> with the correct protocol, host name and port to your+ <li data-list-item-id="e9707bf9bba8c058b72a64034deaaf5e1"><code>TOKEN</code> with your ETAPI token.</li>+ <li data-list-item-id="e479cb73c11d13a63d7d54cb6f35c3cd7"><code>SERVER</code> with the correct protocol, host name and port to yourTrilium instance.</li>- <li><code>NOTE_ID</code> with an existing note ID to download.</li>-</ul>\ No newline at end of file+ <li data-list-item-id="e51a5af5ecb3055bd3d6c93bbc9cde2af"><code>NOTE_ID</code> with an existing note ID to download.</li>+</ul>+<p>As another example, to obtain a .zip export of a note and place it in+ a directory called <code>out</code>, simply replace the last statement in+ the script with:</p><pre><code class="language-text-x-trilium-auto">curl -H "Authorization: $TOKEN" \+ -X GET "$SERVER/etapi/notes/$NOTE_ID/export" \++ --output "out/$NOTE_ID.zip"</code></pre>\ No newline at end of filediff --git a/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API).md b/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API).mdindex 4ea811020c..12c2840557 100644--- a/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API).md+++ b/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API).md@@ -61,4 +61,12 @@ Make sure to replace the values of:* `TOKEN` with your ETAPI token.* `SERVER` with the correct protocol, host name and port to your Trilium instance.-* `NOTE_ID` with an existing note ID to download.\ No newline at end of file+* `NOTE_ID` with an existing note ID to download.++As another example, to obtain a .zip export of a note and place it in a directory called `out`, simply replace the last statement in the script with:++```+curl -H "Authorization: $TOKEN" \+ -X GET "$SERVER/etapi/notes/$NOTE_ID/export" \+ --output "out/$NOTE_ID.zip"+```\ No newline at end of file