mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-03 22:51:34 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTTP
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTTP
		
	
	
	
	
	
POST {{triliumHost}}/etapi/create-note
 | 
						|
Authorization: {{authToken}}
 | 
						|
Content-Type: application/json
 | 
						|
 | 
						|
{
 | 
						|
  "parentNoteId": "root",
 | 
						|
  "title": "Hello",
 | 
						|
  "type": "text",
 | 
						|
  "content": "Hi there!"
 | 
						|
}
 | 
						|
 | 
						|
> {% client.global.set("createdNoteId", response.body.note.noteId); %}
 | 
						|
 | 
						|
###
 | 
						|
 | 
						|
POST {{triliumHost}}/etapi/attributes
 | 
						|
Authorization: {{authToken}}
 | 
						|
Content-Type: application/json
 | 
						|
 | 
						|
{
 | 
						|
  "noteId": "{{createdNoteId}}",
 | 
						|
  "type": "label",
 | 
						|
  "name": "mylabel",
 | 
						|
  "value": "val",
 | 
						|
  "isInheritable": true
 | 
						|
}
 | 
						|
 | 
						|
> {% client.global.set("createdAttributeId", response.body.attributeId); %}
 | 
						|
 | 
						|
###
 | 
						|
 | 
						|
DELETE {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
 | 
						|
Authorization: {{authToken}}
 | 
						|
 | 
						|
> {% client.assert(response.status === 204, "Response status is not 204"); %}
 | 
						|
 | 
						|
### repeat the DELETE request to test the idempotency
 | 
						|
 | 
						|
DELETE {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
 | 
						|
Authorization: {{authToken}}
 | 
						|
 | 
						|
> {% client.assert(response.status === 204, "Response status is not 204"); %}
 | 
						|
 | 
						|
###
 | 
						|
 | 
						|
GET {{triliumHost}}/etapi/attributes/{{createdAttributeId}}
 | 
						|
Authorization: {{authToken}}
 | 
						|
 | 
						|
> {%
 | 
						|
    client.assert(response.status === 404, "Response status is not 404");
 | 
						|
    client.assert(response.body.code === "ATTRIBUTE_NOT_FOUND");
 | 
						|
%}
 |