patch-attribute.http 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. ###
  15. POST {{triliumHost}}/etapi/attributes
  16. Authorization: {{authToken}}
  17. Content-Type: application/json
  18. {
  19. "noteId": "{{createdNoteId}}",
  20. "type": "label",
  21. "name": "mylabel",
  22. "value": "val",
  23. "isInheritable": true
  24. }
  25. > {% client.global.set("createdAttributeId", response.body.attributeId); %}
  26. ###
  27. PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
  28. Authorization: {{authToken}}
  29. Content-Type: application/json
  30. {
  31. "value": "CHANGED"
  32. }
  33. ###
  34. GET {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
  35. Authorization: {{authToken}}
  36. > {%
  37. client.assert(response.body.value === "CHANGED");
  38. %}
  39. ###
  40. PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
  41. Authorization: {{authToken}}
  42. Content-Type: application/json
  43. {
  44. "noteId": "root"
  45. }
  46. > {%
  47. client.assert(response.status === 400);
  48. client.assert(response.body.code == "PROPERTY_NOT_ALLOWED");
  49. %}
  50. ###
  51. PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
  52. Authorization: {{authToken}}
  53. Content-Type: application/json
  54. {
  55. "value": null
  56. }
  57. > {%
  58. client.assert(response.status === 400);
  59. client.assert(response.body.code == "PROPERTY_VALIDATION_ERROR");
  60. %}