put-attachment-content.http 940 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. PUT {{triliumHost}}/etapi/attachments/{{createdAttachmentId}}/content
  25. Authorization: {{authToken}}
  26. Content-Type: text/plain
  27. Changed content
  28. > {% client.assert(response.status === 204); %}
  29. ###
  30. GET {{triliumHost}}/etapi/attachments/{{createdAttachmentId}}/content
  31. Authorization: {{authToken}}
  32. > {% client.assert(response.body === "Changed content"); %}