trilium/test-etapi/patch-attribute.http

80 lines
1.5 KiB
Text
Raw Normal View History

2022-01-08 02:33:59 +08:00
POST {{triliumHost}}/etapi/create-note
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
Content-Type: application/json
{
"parentNoteId": "root",
"title": "Hello",
"type": "text",
"content": "Hi there!"
}
> {%
client.global.set("createdNoteId", response.body.note.noteId);
client.global.set("createdBranchId", response.body.branch.branchId);
%}
###
POST {{triliumHost}}/etapi/attributes
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
Content-Type: application/json
{
"noteId": "{{createdNoteId}}",
"type": "label",
"name": "mylabel",
"value": "val",
2022-01-13 02:32:23 +08:00
"isInheritable": true
2022-01-08 02:33:59 +08:00
}
> {% client.global.set("createdAttributeId", response.body.attributeId); %}
###
PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
Content-Type: application/json
{
"value": "CHANGED"
}
###
GET {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
> {%
client.assert(response.body.value === "CHANGED");
%}
###
PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
Content-Type: application/json
{
"noteId": "root"
}
> {%
client.assert(response.status === 400);
2022-01-13 02:32:23 +08:00
client.assert(response.body.code == "PROPERTY_NOT_ALLOWED");
2022-01-08 02:33:59 +08:00
%}
###
PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
Content-Type: application/json
{
"value": null
}
> {%
client.assert(response.status === 400);
client.assert(response.body.code == "PROPERTY_VALIDATION_ERROR");
%}