trilium/test-etapi/delete-attribute.http

70 lines
1.5 KiB
Plaintext
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); %}
###
GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
2022-01-13 02:32:23 +08:00
> {% client.assert(response.status === 200); %}
2022-01-08 02:33:59 +08:00
###
GET {{triliumHost}}/etapi/branches/{{createdBranchId}}
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
2022-01-13 02:32:23 +08:00
> {% client.assert(response.status === 200); %}
2022-01-08 02:33:59 +08:00
###
DELETE {{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.status === 204, "Response status is not 204"); %}
2022-01-08 19:01:54 +08:00
### repeat the DELETE request to test the idempotency
DELETE {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 19:01:54 +08:00
> {% client.assert(response.status === 204, "Response status is not 204"); %}
2022-01-08 02:33:59 +08:00
###
GET {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
2022-01-08 19:01:54 +08:00
> {%
client.assert(response.status === 404, "Response status is not 404");
client.assert(response.body.code === "ATTRIBUTE_NOT_FOUND");
%}