From 8a6ead6d862480b74276b3fd16734bfd444c5da4 Mon Sep 17 00:00:00 2001 From: James Hynes Date: Fri, 16 Sep 2022 13:18:01 +1000 Subject: [PATCH] fix a couple of api shortcomings * add note content to openapi spec file * add test for get note content api endpoint --- src/etapi/etapi.openapi.yaml | 17 +++++++++++++++++ test-etapi/get-note-content.http | 25 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 test-etapi/get-note-content.http diff --git a/src/etapi/etapi.openapi.yaml b/src/etapi/etapi.openapi.yaml index 47e8d22a8..a05f6b3b2 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 000000000..2f22dabbe --- /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 === "

Hi there!

"); +%}