1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Update website

This commit is contained in:
Helmut K. C. Tessarek 2019-04-21 14:55:52 -04:00
parent e394034678
commit da35785951
No known key found for this signature in database
GPG Key ID: BE0985349D44DD00
2 changed files with 464 additions and 5 deletions

View File

@ -250,6 +250,458 @@
</li>
</ul>
</div>
<h1 id="joplin-api">Joplin API</h1>
<p>When the Web Clipper service is enabled, Joplin exposes a <a href="https://en.wikipedia.org/wiki/Representational_state_transfer">REST API</a> which allows third-party applications to access Joplin&#39;s data and to create, modify or delete notes, notebooks, resources or tags.</p>
<p>In order to use it, you&#39;ll first need to find on which port the service is running. To do so, open the Web Clipper Options in Joplin and if the service is running it should tell you on which port. Normally it runs on port <strong>41184</strong>. If you want to find it programmatically, you may follow this kind of algorithm:</p>
<pre><code class="lang-javascript">let port = null;
for (let portToTest = 41184; portToTest &lt;= 41194; portToTest++) {
const result = pingPort(portToTest); // Call GET /ping
if (result == &#39;JoplinClipperServer&#39;) {
port = portToTest; // Found the port
break;
}
}
</code></pre>
<h1 id="authorisation">Authorisation</h1>
<p>To prevent unauthorised applications from accessing the API, the calls must be authentified. To do so, you must provide a token as a query parameter for each API call. You can get this token from the Joplin desktop application, on the Web Clipper Options screen.</p>
<p>This would be an example of valid cURL call using a token:</p>
<pre><code>curl http://localhost:41184/notes?token=ABCD123ABCD123ABCD123ABCD123ABCD123
</code></pre><p>In the documentation below, the token will not be specified every time however you will need to include it.</p>
<h1 id="using-the-api">Using the API</h1>
<p>All the calls, unless noted otherwise, receives and send <strong>JSON data</strong>. For example to create a new note:</p>
<pre><code>curl --data &#39;{ &quot;title&quot;: &quot;My note&quot;, &quot;body&quot;: &quot;Some note in **Markdown**&quot;}&#39; http://localhost:41184/notes
</code></pre><p>In the documentation below, the calls may include special parameters such as :id or :note_id. You would replace this with the item ID or note ID.</p>
<p>For example, for the endpoint <code>DELETE /tags/:id/notes/:note_id</code>, to remove the tag with ID &quot;ABCD1234&quot; from the note with ID &quot;EFGH789&quot;, you would run for example:</p>
<pre><code>curl -X DELETE http://localhost:41184/tags/ABCD1234/notes/EFGH789
</code></pre><p>The four verbs supported by the API are the following ones:</p>
<ul>
<li><strong>GET</strong>: To retrieve items (notes, notebooks, etc.).</li>
<li><strong>POST</strong>: To create new items. In general most item properties are optional. If you omit any, a default value will be used.</li>
<li><strong>PUT</strong>: To update an item. Note in a REST API, traditionally PUT is used to completely replace an item, however in this API it will only replace the properties that are provided. For example if you PUT {&quot;title&quot;: &quot;my new title&quot;}, only the &quot;title&quot; property will be changed. The other properties will be left untouched (they won&#39;t be cleared nor changed).</li>
<li><strong>DELETE</strong>: To delete items.</li>
</ul>
<h1 id="filtering-data">Filtering data</h1>
<p>You can change the fields that will be returned by the API using the <code>fields=</code> query parameter, which takes a list of comma separated fields. For example, to get the longitude and latitude of a note, use this:</p>
<pre><code>curl http://localhost:41184/notes/ABCD123?fields=longitude,latitude
</code></pre><p>To get the IDs only of all the tags:</p>
<pre><code>curl http://localhost:41184/tags?fields=id
</code></pre><h1 id="error-handling">Error handling</h1>
<p>In case of an error, an HTTP status code &gt;= 400 will be returned along with a JSON object that provides more info about the error. The JSON object is in the format <code>{ &quot;error&quot;: &quot;description of error&quot; }</code>.</p>
<h1 id="about-the-property-types">About the property types</h1>
<ul>
<li>Text is UTF-8.</li>
<li>All date/time are Unix timestamps in milliseconds.</li>
<li>Booleans are integer values 0 or 1.</li>
</ul>
<h1 id="testing-if-the-service-is-available">Testing if the service is available</h1>
<p>Call <strong>GET /ping</strong> to check if the service is available. It should return &quot;JoplinClipperServer&quot; if it works.</p>
<h1 id="searching">Searching</h1>
<p>Call <strong>GET /search?query=YOUR_QUERY</strong> to search for notes. This end-point supports the <code>field</code> parameter which is recommended to use so that you only get the data that you need. The query syntax is as described in the main documentation: <a href="https://joplinapp.org/#searching">https://joplinapp.org/#searching</a></p>
<h1 id="notes">Notes</h1>
<h2 id="properties">Properties</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>parent_id</td>
<td>text</td>
<td>ID of the notebook that contains this note. Change this ID to move the note to a different notebook.</td>
</tr>
<tr>
<td>title</td>
<td>text</td>
<td>The note title.</td>
</tr>
<tr>
<td>body</td>
<td>text</td>
<td>The note body, in Markdown. May also contain HTML.</td>
</tr>
<tr>
<td>created_time</td>
<td>int</td>
<td>When the note was created.</td>
</tr>
<tr>
<td>updated_time</td>
<td>int</td>
<td>When the note was last updated.</td>
</tr>
<tr>
<td>is_conflict</td>
<td>int</td>
<td>Tells whether the note is a conflict or not.</td>
</tr>
<tr>
<td>latitude</td>
<td>numeric</td>
<td></td>
</tr>
<tr>
<td>longitude</td>
<td>numeric</td>
<td></td>
</tr>
<tr>
<td>altitude</td>
<td>numeric</td>
<td></td>
</tr>
<tr>
<td>author</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>source_url</td>
<td>text</td>
<td>The full URL where the note comes from.</td>
</tr>
<tr>
<td>is_todo</td>
<td>int</td>
<td>Tells whether this note is a todo or not.</td>
</tr>
<tr>
<td>todo_due</td>
<td>int</td>
<td>When the todo is due. An alarm will be triggered on that date.</td>
</tr>
<tr>
<td>todo_completed</td>
<td>int</td>
<td>Tells whether todo is completed or not. This is a timestamp in milliseconds.</td>
</tr>
<tr>
<td>source</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>source_application</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>application_data</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>order</td>
<td>int</td>
<td></td>
</tr>
<tr>
<td>user_created_time</td>
<td>int</td>
<td>When the note was created. It may differ from created_time as it can be manually set by the user.</td>
</tr>
<tr>
<td>user_updated_time</td>
<td>int</td>
<td>When the note was last updated. It may differ from updated_time as it can be manually set by the user.</td>
</tr>
<tr>
<td>encryption_cipher_text</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>encryption_applied</td>
<td>int</td>
<td></td>
</tr>
<tr>
<td>body_html</td>
<td>text</td>
<td>Note body, in HTML format</td>
</tr>
<tr>
<td>base_url</td>
<td>text</td>
<td>If <code>body_html</code> is provided and contains relative URLs, provide the <code>base_url</code> parameter too so that all the URLs can be converted to absolute ones. The base URL is basically where the HTML was fetched from, minus the query (everything after the &#39;?&#39;). For example if the original page was <code>https://stackoverflow.com/search?q=%5Bjava%5D+test</code>, the base URL is <code>https://stackoverflow.com/search</code>.</td>
</tr>
<tr>
<td>image_data_url</td>
<td>text</td>
<td>An image to attach to the note, in <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs">Data URL</a> format.</td>
</tr>
<tr>
<td>crop_rect</td>
<td>text</td>
<td>If an image is provided, you can also specify an optional rectangle that will be used to crop the image. In format <code>{ x: x, y: y, width: width, height: height }</code></td>
</tr>
</tbody>
</table>
<h2 id="get-notes">GET /notes</h2>
<p>Gets all notes</p>
<h2 id="get-notes-id">GET /notes/:id</h2>
<p>Gets note with ID :id</p>
<h2 id="get-notes-id-tags">GET /notes/:id/tags</h2>
<p>Gets all the tags attached to this note.</p>
<h2 id="post-notes">POST /notes</h2>
<p>Creates a new note</p>
<p>You can either specify the note body as Markdown by setting the <code>body</code> parameter, or in HTML by setting the <code>body_html</code>.</p>
<p>Examples:</p>
<ul>
<li><p>Create a note from some Markdown text</p>
<pre><code>curl --data &#39;{ &quot;title&quot;: &quot;My note&quot;, &quot;body&quot;: &quot;Some note in **Markdown**&quot;}&#39; http://127.0.0.1:41184/notes
</code></pre></li>
<li><p>Create a note from some HTML</p>
<pre><code>curl --data &#39;{ &quot;title&quot;: &quot;My note&quot;, &quot;body_html&quot;: &quot;Some note in &lt;b&gt;HTML&lt;/b&gt;&quot;}&#39; http://127.0.0.1:41184/notes
</code></pre></li>
<li><p>Create a note and attach an image to it:</p>
<pre><code>curl --data &#39;{ &quot;title&quot;: &quot;Image test&quot;, &quot;body&quot;: &quot;Here is Joplin icon:&quot;, &quot;image_data_url&quot;: &quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUeNoAyAA3/wFwtO3K6gUB/vz2+Prw9fj/+/r+/wBZKAAExOgF4/MC9ff+MRH6Ui4E+/0Bqc/zutj6AgT+/Pz7+vv7++nu82c4DlMqCvLs8goA/gL8/fz09fb59vXa6vzZ6vjT5fbn6voD/fwC8vX4UiT9Zi//APHyAP8ACgUBAPv5APz7BPj2+DIaC2o3E+3o6ywaC5fT6gD6/QD9/QEVf9kD+/dcLQgJA/7v8vqfwOf18wA1IAIEVycAyt//v9XvAPv7APz8LhoIAPz9Ri4OAgwARgx4W/6fVeEAAAAASUVORK5CYII=&quot;}&#39; http://127.0.0.1:41184/notes
</code></pre></li>
</ul>
<h3 id="creating-a-note-with-a-specific-id">Creating a note with a specific ID</h3>
<p>When a new note is created, it is automatically assigned a new unique ID so <strong>normally you do not need to set the ID</strong>. However, if for some reason you want to set it, you can supply it as the <code>id</code> property. It needs to be a 32 characters long hexadecimal string. <strong>Make sure it is unique</strong>, for example by generating it using whatever GUID function is available in your programming language.</p>
<pre><code> curl --data &#39;{ &quot;id&quot;: &quot;00a87474082744c1a8515da6aa5792d2&quot;, &quot;title&quot;: &quot;My note with custom ID&quot;}&#39; http://127.0.0.1:41184/notes
</code></pre><h2 id="put-notes-id">PUT /notes/:id</h2>
<p>Sets the properties of the note with ID :id</p>
<h2 id="delete-notes-id">DELETE /notes/:id</h2>
<p>Deletes the note with ID :id</p>
<h1 id="folders">Folders</h1>
<p>This is actually a notebook. Internally notebooks are called &quot;folders&quot;.</p>
<h2 id="properties">Properties</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>title</td>
<td>text</td>
<td>The folder title.</td>
</tr>
<tr>
<td>created_time</td>
<td>int</td>
<td>When the folder was created.</td>
</tr>
<tr>
<td>updated_time</td>
<td>int</td>
<td>When the folder was last updated.</td>
</tr>
<tr>
<td>user_created_time</td>
<td>int</td>
<td>When the folder was created. It may differ from created_time as it can be manually set by the user.</td>
</tr>
<tr>
<td>user_updated_time</td>
<td>int</td>
<td>When the folder was last updated. It may differ from updated_time as it can be manually set by the user.</td>
</tr>
<tr>
<td>encryption_cipher_text</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>encryption_applied</td>
<td>int</td>
<td></td>
</tr>
<tr>
<td>parent_id</td>
<td>text</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="get-folders">GET /folders</h2>
<p>Gets all folders</p>
<p>The folders are returned as a tree. The sub-notebooks of a notebook, if any, are under the <code>children</code> key.</p>
<h2 id="get-folders-id">GET /folders/:id</h2>
<p>Gets folder with ID :id</p>
<h2 id="get-folders-id-notes">GET /folders/:id/notes</h2>
<p>Gets all the notes inside this folder.</p>
<h2 id="post-folders">POST /folders</h2>
<p>Creates a new folder</p>
<h2 id="put-folders-id">PUT /folders/:id</h2>
<p>Sets the properties of the folder with ID :id</p>
<h2 id="delete-folders-id">DELETE /folders/:id</h2>
<p>Deletes the folder with ID :id</p>
<h1 id="resources">Resources</h1>
<h2 id="properties">Properties</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>title</td>
<td>text</td>
<td>The resource title.</td>
</tr>
<tr>
<td>mime</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>filename</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>created_time</td>
<td>int</td>
<td>When the resource was created.</td>
</tr>
<tr>
<td>updated_time</td>
<td>int</td>
<td>When the resource was last updated.</td>
</tr>
<tr>
<td>user_created_time</td>
<td>int</td>
<td>When the resource was created. It may differ from created_time as it can be manually set by the user.</td>
</tr>
<tr>
<td>user_updated_time</td>
<td>int</td>
<td>When the resource was last updated. It may differ from updated_time as it can be manually set by the user.</td>
</tr>
<tr>
<td>file_extension</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>encryption_cipher_text</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>encryption_applied</td>
<td>int</td>
<td></td>
</tr>
<tr>
<td>encryption_blob_encrypted</td>
<td>int</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="get-resources">GET /resources</h2>
<p>Gets all resources</p>
<h2 id="get-resources-id">GET /resources/:id</h2>
<p>Gets resource with ID :id</p>
<h2 id="get-resources-id-file">GET /resources/:id/file</h2>
<p>Gets the actual file associated with this resource.</p>
<h2 id="post-resources">POST /resources</h2>
<p>Creates a new resource</p>
<p>Creating a new resource is special because you also need to upload the file. Unlike other API calls, this one must have the &quot;multipart/form-data&quot; Content-Type. The file data must be passed to the &quot;data&quot; form field, and the other properties to the &quot;props&quot; form field. An example of a valid call with cURL would be:</p>
<pre><code>curl -F &#39;data=@/path/to/file.jpg&#39; -F &#39;props={&quot;title&quot;:&quot;my resource title&quot;}&#39; http://localhost:41184/resources
</code></pre><p>The &quot;data&quot; field is required, while the &quot;props&quot; one is not. If not specified, default values will be used.</p>
<h2 id="put-resources-id">PUT /resources/:id</h2>
<p>Sets the properties of the resource with ID :id</p>
<h2 id="delete-resources-id">DELETE /resources/:id</h2>
<p>Deletes the resource with ID :id</p>
<h1 id="tags">Tags</h1>
<h2 id="properties">Properties</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>title</td>
<td>text</td>
<td>The tag title.</td>
</tr>
<tr>
<td>created_time</td>
<td>int</td>
<td>When the tag was created.</td>
</tr>
<tr>
<td>updated_time</td>
<td>int</td>
<td>When the tag was last updated.</td>
</tr>
<tr>
<td>user_created_time</td>
<td>int</td>
<td>When the tag was created. It may differ from created_time as it can be manually set by the user.</td>
</tr>
<tr>
<td>user_updated_time</td>
<td>int</td>
<td>When the tag was last updated. It may differ from updated_time as it can be manually set by the user.</td>
</tr>
<tr>
<td>encryption_cipher_text</td>
<td>text</td>
<td></td>
</tr>
<tr>
<td>encryption_applied</td>
<td>int</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="get-tags">GET /tags</h2>
<p>Gets all tags</p>
<h2 id="get-tags-id">GET /tags/:id</h2>
<p>Gets tag with ID :id</p>
<h2 id="get-tags-id-notes">GET /tags/:id/notes</h2>
<p>Gets all the notes with this tag.</p>
<h2 id="post-tags">POST /tags</h2>
<p>Creates a new tag</p>
<h2 id="post-tags-id-notes">POST /tags/:id/notes</h2>
<p>Post a note to this endpoint to add the tag to the note. The note data must at least contain an ID property (all other properties will be ignored).</p>
<h2 id="put-tags-id">PUT /tags/:id</h2>
<p>Sets the properties of the tag with ID :id</p>
<h2 id="delete-tags-id">DELETE /tags/:id</h2>
<p>Deletes the tag with ID :id</p>
<h2 id="delete-tags-id-notes-note_id">DELETE /tags/:id/notes/:note_id</h2>
<p>Remove the tag from the note.</p>
<script>
function stickyHeader() {

View File

@ -303,7 +303,7 @@
<tr>
<td>Android</td>
<td><a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="40px" src='https://joplinapp.org/images/BadgeAndroid.png'/></a></td>
<td>or <a href="https://github.com/laurent22/joplin-android/releases/download/android-v1.0.242/joplin-v1.0.242.apk">Download APK File</a></td>
<td>or <a href="https://github.com/laurent22/joplin-android/releases/download/android-v1.0.243/joplin-v1.0.243.apk">Download APK File</a></td>
</tr>
<tr>
<td>iOS</td>
@ -681,16 +681,23 @@ $$
<td>Deutsch</td>
<td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/de_DE.po">de_DE</a></td>
<td>Michael Sonntag (ms@editorei.de)</td>
<td>97%</td>
<td>96%</td>
</tr>
<tr>
<td><img src="https://joplinapp.org/images/flags/country-4x3/gb.png" alt=""></td>
<td>English</td>
<td>English (UK)</td>
<td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/en_GB.po">en_GB</a></td>
<td></td>
<td>100%</td>
</tr>
<tr>
<td><img src="https://joplinapp.org/images/flags/country-4x3/us.png" alt=""></td>
<td>English (US)</td>
<td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/en_US.po">en_US</a></td>
<td></td>
<td>7%</td>
</tr>
<tr>
<td><img src="https://joplinapp.org/images/flags/country-4x3/es.png" alt=""></td>
<td>Español</td>
<td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/es_ES.po">es_ES</a></td>
@ -737,7 +744,7 @@ $$
<td>Norwegian</td>
<td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/nb_NO.po">nb_NO</a></td>
<td>Mats Estensen (code@mxe.no)</td>
<td>97%</td>
<td>96%</td>
</tr>
<tr>
<td><img src="https://joplinapp.org/images/flags/country-4x3/br.png" alt=""></td>
@ -786,7 +793,7 @@ $$
<td>中文 (简体)</td>
<td><a href="https://github.com/laurent22/joplin/blob/master/CliClient/locales/zh_CN.po">zh_CN</a></td>
<td></td>
<td>97%</td>
<td>96%</td>
</tr>
<tr>
<td><img src="https://joplinapp.org/images/flags/country-4x3/tw.png" alt=""></td>