| 
									
										
										
										
											2022-01-07 19:33:59 +01:00
										 |  |  | POST {{triliumHost}}/etapi/create-note | 
					
						
							|  |  |  | 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 | 
					
						
							|  |  |  | Content-Type: application/json | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "noteId": "{{createdNoteId}}", | 
					
						
							|  |  |  |   "type": "label", | 
					
						
							|  |  |  |   "name": "mylabel", | 
					
						
							|  |  |  |   "value": "val", | 
					
						
							|  |  |  |   "isInheritable": "true" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > {% client.global.set("createdAttributeId", response.body.attributeId); %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### Clone to another location | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | POST {{triliumHost}}/etapi/branches | 
					
						
							|  |  |  | Content-Type: application/json | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "noteId": "{{createdNoteId}}", | 
					
						
							|  |  |  |   "parentNoteId": "hidden" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > {% client.global.set("clonedBranchId", response.body.branchId); %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GET {{triliumHost}}/etapi/notes/{{createdNoteId}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > {% client.assert(response.status === 200, "Response status is not 200"); %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GET {{triliumHost}}/etapi/branches/{{createdBranchId}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > {% client.assert(response.status === 200, "Response status is not 200"); %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GET {{triliumHost}}/etapi/branches/{{clonedBranchId}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > {% client.assert(response.status === 200, "Response status is not 200"); %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GET {{triliumHost}}/etapi/attributes/{{createdAttributeId}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > {% client.assert(response.status === 200, "Response status is not 200"); %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DELETE {{triliumHost}}/etapi/notes/{{createdNoteId}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > {% client.assert(response.status === 204, "Response status is not 204"); %} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 12:01:54 +01:00
										 |  |  | ### repeat the DELETE request to test the idempotency | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DELETE {{triliumHost}}/etapi/notes/{{createdNoteId}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > {% client.assert(response.status === 204, "Response status is not 204"); %} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-07 19:33:59 +01:00
										 |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GET {{triliumHost}}/etapi/branches/{{createdBranchId}} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 12:01:54 +01:00
										 |  |  | > {% | 
					
						
							|  |  |  |     client.assert(response.status === 404, "Response status is not 404"); | 
					
						
							|  |  |  |     client.assert(response.body.code === "BRANCH_NOT_FOUND"); | 
					
						
							| 
									
										
										
										
											2022-01-07 19:33:59 +01:00
										 |  |  | %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GET {{triliumHost}}/etapi/branches/{{clonedBranchId}} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 12:01:54 +01:00
										 |  |  | > {% | 
					
						
							|  |  |  |     client.assert(response.status === 404, "Response status is not 404"); | 
					
						
							| 
									
										
										
										
											2022-01-07 19:33:59 +01:00
										 |  |  |     client.assert(response.body.code == "BRANCH_NOT_FOUND"); | 
					
						
							|  |  |  | %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GET {{triliumHost}}/etapi/notes/{{createdNoteId}} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 12:01:54 +01:00
										 |  |  | > {% | 
					
						
							|  |  |  |     client.assert(response.status === 404, "Response status is not 404"); | 
					
						
							|  |  |  |     client.assert(response.body.code === "NOTE_NOT_FOUND"); | 
					
						
							| 
									
										
										
										
											2022-01-07 19:33:59 +01:00
										 |  |  | %} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GET {{triliumHost}}/etapi/attributes/{{createdAttributeId}} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 12:01:54 +01:00
										 |  |  | > {% | 
					
						
							|  |  |  |     client.assert(response.status === 404, "Response status is not 404"); | 
					
						
							|  |  |  |     client.assert(response.body.code === "ATTRIBUTE_NOT_FOUND"); | 
					
						
							|  |  |  | %} |