mirror of
https://github.com/zadam/trilium.git
synced 2025-01-15 11:39:37 +08:00
52 lines
1.2 KiB
HTTP
52 lines
1.2 KiB
HTTP
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); %}
|
|
|
|
###
|
|
|
|
POST {{triliumHost}}/etapi/attachments
|
|
Authorization: {{authToken}}
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"parentId": "{{createdNoteId}}",
|
|
"role": "file",
|
|
"mime": "text/plain",
|
|
"title": "my attachment",
|
|
"content": "text"
|
|
}
|
|
|
|
> {% client.global.set("createdAttachmentId", response.body.attachmentId); %}
|
|
|
|
###
|
|
|
|
DELETE {{triliumHost}}/etapi/attachments/{{createdAttachmentId}}
|
|
Authorization: {{authToken}}
|
|
|
|
> {% client.assert(response.status === 204, "Response status is not 204"); %}
|
|
|
|
### repeat the DELETE request to test the idempotency
|
|
|
|
DELETE {{triliumHost}}/etapi/attachments/{{createdAttachmentId}}
|
|
Authorization: {{authToken}}
|
|
|
|
> {% client.assert(response.status === 204, "Response status is not 204"); %}
|
|
|
|
###
|
|
|
|
GET {{triliumHost}}/etapi/attachments/{{createdAttachmentId}}
|
|
Authorization: {{authToken}}
|
|
|
|
> {%
|
|
client.assert(response.status === 404, "Response status is not 404");
|
|
client.assert(response.body.code === "ATTACHMENT_NOT_FOUND");
|
|
%}
|