patch-note.http 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. POST {{triliumHost}}/etapi/create-note
  2. Authorization: {{authToken}}
  3. Content-Type: application/json
  4. {
  5. "parentNoteId": "root",
  6. "title": "Hello",
  7. "type": "code",
  8. "mime": "application/json",
  9. "content": "{}"
  10. }
  11. > {% client.global.set("createdNoteId", response.body.note.noteId); %}
  12. ###
  13. GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
  14. Authorization: {{authToken}}
  15. > {%
  16. client.assert(response.status === 200);
  17. client.assert(response.body.title === 'Hello');
  18. client.assert(response.body.type === 'code');
  19. client.assert(response.body.mime === 'application/json');
  20. %}
  21. ###
  22. PATCH {{triliumHost}}/etapi/notes/{{createdNoteId}}
  23. Authorization: {{authToken}}
  24. Content-Type: application/json
  25. {
  26. "title": "Wassup",
  27. "type": "html",
  28. "mime": "text/html",
  29. "dateCreated": "2023-08-21 23:38:51.123+0200",
  30. "utcDateCreated": "2023-08-21 23:38:51.123Z"
  31. }
  32. ###
  33. GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
  34. Authorization: {{authToken}}
  35. > {%
  36. client.assert(response.status === 200);
  37. client.assert(response.body.title === 'Wassup');
  38. client.assert(response.body.type === 'html');
  39. client.assert(response.body.mime === 'text/html');
  40. client.assert(response.body.dateCreated == "2023-08-21 23:38:51.123+0200");
  41. client.assert(response.body.utcDateCreated == "2023-08-21 23:38:51.123Z");
  42. %}
  43. ###
  44. PATCH {{triliumHost}}/etapi/notes/{{createdNoteId}}
  45. Authorization: {{authToken}}
  46. Content-Type: application/json
  47. {
  48. "isProtected": true
  49. }
  50. > {%
  51. client.assert(response.status === 400);
  52. client.assert(response.body.code == "PROPERTY_NOT_ALLOWED");
  53. %}
  54. ###
  55. PATCH {{triliumHost}}/etapi/notes/{{createdNoteId}}
  56. Authorization: {{authToken}}
  57. Content-Type: application/json
  58. {
  59. "title": true
  60. }
  61. > {%
  62. client.assert(response.status === 400);
  63. client.assert(response.body.code == "PROPERTY_VALIDATION_ERROR");
  64. %}