delete-cloned-branch.http 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. > {%
  11. client.global.set("createdNoteId", response.body.note.noteId);
  12. client.global.set("createdBranchId", response.body.branch.branchId);
  13. %}
  14. ### Clone to another location
  15. POST {{triliumHost}}/etapi/branches
  16. Authorization: {{authToken}}
  17. Content-Type: application/json
  18. {
  19. "noteId": "{{createdNoteId}}",
  20. "parentNoteId": "_hidden"
  21. }
  22. > {% client.global.set("clonedBranchId", response.body.branchId); %}
  23. ###
  24. GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
  25. Authorization: {{authToken}}
  26. > {% client.assert(response.status === 200); %}
  27. ###
  28. GET {{triliumHost}}/etapi/branches/{{createdBranchId}}
  29. Authorization: {{authToken}}
  30. > {% client.assert(response.status === 200); %}
  31. ###
  32. GET {{triliumHost}}/etapi/branches/{{clonedBranchId}}
  33. Authorization: {{authToken}}
  34. > {% client.assert(response.status === 200); %}
  35. ###
  36. DELETE {{triliumHost}}/etapi/branches/{{createdBranchId}}
  37. Authorization: {{authToken}}
  38. > {% client.assert(response.status === 204, "Response status is not 204"); %}
  39. ### repeat the DELETE request to test the idempotency
  40. DELETE {{triliumHost}}/etapi/branches/{{createdBranchId}}
  41. Authorization: {{authToken}}
  42. > {% client.assert(response.status === 204, "Response status is not 204"); %}
  43. ###
  44. GET {{triliumHost}}/etapi/branches/{{createdBranchId}}
  45. Authorization: {{authToken}}
  46. > {%
  47. client.assert(response.status === 404, "Response status is not 404");
  48. client.assert(response.body.code === "BRANCH_NOT_FOUND");
  49. %}
  50. ###
  51. GET {{triliumHost}}/etapi/branches/{{clonedBranchId}}
  52. Authorization: {{authToken}}
  53. > {% client.assert(response.status === 200); %}
  54. ###
  55. GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
  56. Authorization: {{authToken}}
  57. > {% client.assert(response.status === 200); %}