delete-attachment.http 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. POST {{triliumHost}}/etapi/create-note
  2. Authorization: {{authToken}}
  3. Content-Type: application/json
  4. {
  5. "parentNoteId": "root",
  6. "title": "Hello",
  7. "type": "text",
  8. "content": "Hi there!"
  9. }
  10. > {% client.global.set("createdNoteId", response.body.note.noteId); %}
  11. ###
  12. POST {{triliumHost}}/etapi/attachments
  13. Authorization: {{authToken}}
  14. Content-Type: application/json
  15. {
  16. "ownerId": "{{createdNoteId}}",
  17. "role": "file",
  18. "mime": "text/plain",
  19. "title": "my attachment",
  20. "content": "text"
  21. }
  22. > {% client.global.set("createdAttachmentId", response.body.attachmentId); %}
  23. ###
  24. DELETE {{triliumHost}}/etapi/attachments/{{createdAttachmentId}}
  25. Authorization: {{authToken}}
  26. > {% client.assert(response.status === 204, "Response status is not 204"); %}
  27. ### repeat the DELETE request to test the idempotency
  28. DELETE {{triliumHost}}/etapi/attachments/{{createdAttachmentId}}
  29. Authorization: {{authToken}}
  30. > {% client.assert(response.status === 204, "Response status is not 204"); %}
  31. ###
  32. GET {{triliumHost}}/etapi/attachments/{{createdAttachmentId}}
  33. Authorization: {{authToken}}
  34. > {%
  35. client.assert(response.status === 404, "Response status is not 404");
  36. client.assert(response.body.code === "ATTACHMENT_NOT_FOUND");
  37. %}