Skip to content

Build your personal knowledge base with Trilium Notes

fix a couple of api shortcomings

James Hynes8a6ead6d8624
diff --git a/src/etapi/etapi.openapi.yaml b/src/etapi/etapi.openapi.yaml
index 47e8d22a8d..a05f6b3b2f 100644
--- a/src/etapi/etapi.openapi.yaml
+++ b/src/etapi/etapi.openapi.yaml
@@ -228,6 +228,23 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
+ /notes/{noteId}/content:
+ parameters:
+ - name: noteId
+ in: path
+ required: true
+ schema:
+ $ref: '#/components/schemas/EntityId'
+ get:
+ description: Returns note content idenfied by its ID
+ operationId: getNoteContent
+ responses:
+ '200':
+ description: note content response
+ content:
+ text/html:
+ schema:
+ type: string
/notes/{noteId}/export:
parameters:
- name: noteId
diff --git a/test-etapi/get-note-content.http b/test-etapi/get-note-content.http
new file mode 100644
index 0000000000..2f22dabbee
--- /dev/null
+++ b/test-etapi/get-note-content.http
@@ -0,0 +1,25 @@
+POST {{triliumHost}}/etapi/create-note
+Authorization: {{authToken}}
+Content-Type: application/json
+
+{
+ "parentNoteId": "root",
+ "title": "Hello",
+ "type": "text",
+ "content": "Hi there!"
+}
+
+> {%
+ client.global.set("createdNoteId", response.body.note.noteId);
+ client.global.set("createdBranchId", response.body.branch.branchId);
+%}
+
+###
+
+GET {{triliumHost}}/etapi/notes/{{createdNoteId}}/content
+Authorization: {{authToken}}
+
+> {%
+ client.assert(response.status === 200);
+ client.assert(response.body === "<p>Hi there!</p>");
+%}