trilium/test-etapi/delete-cloned-branch.http

88 lines
1.9 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);
%}
### Clone to another location
POST {{triliumHost}}/etapi/branches
2022-01-11 00:09:20 +08:00
Authorization: {{authToken}}
2022-01-08 02:33:59 +08:00
Content-Type: application/json
{
"noteId": "{{createdNoteId}}",
"parentNoteId": "hidden"
}
> {% client.global.set("clonedBranchId", response.body.branchId); %}
###
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
###
GET {{triliumHost}}/etapi/branches/{{clonedBranchId}}
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/branches/{{createdBranchId}}
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/branches/{{createdBranchId}}
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/branches/{{createdBranchId}}
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 === "BRANCH_NOT_FOUND");
2022-01-08 02:33:59 +08:00
%}
###
GET {{triliumHost}}/etapi/branches/{{clonedBranchId}}
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/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); %}