mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 11:56:01 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTTP
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTTP
		
	
	
	
	
	
POST {{triliumHost}}/etapi/create-note
 | 
						|
Authorization: {{authToken}}
 | 
						|
Content-Type: application/json
 | 
						|
 | 
						|
{
 | 
						|
  "parentNoteId": "root",
 | 
						|
  "title": "GetInheritedAttributes Test Note",
 | 
						|
  "type": "text",
 | 
						|
  "content": "Hi there!"
 | 
						|
}
 | 
						|
 | 
						|
> {%
 | 
						|
    client.assert(response.status === 201);
 | 
						|
    client.global.set("parentNoteId", response.body.note.noteId);
 | 
						|
%}
 | 
						|
 | 
						|
###
 | 
						|
 | 
						|
POST {{triliumHost}}/etapi/attributes
 | 
						|
Authorization: {{authToken}}
 | 
						|
Content-Type: application/json
 | 
						|
 | 
						|
{
 | 
						|
  "noteId": "{{parentNoteId}}",
 | 
						|
  "type": "label",
 | 
						|
  "name": "mylabel",
 | 
						|
  "value": "val",
 | 
						|
  "isInheritable": true
 | 
						|
}
 | 
						|
 | 
						|
> {% client.global.set("createdAttributeId", response.body.attributeId); %}
 | 
						|
 | 
						|
###
 | 
						|
 | 
						|
POST {{triliumHost}}/etapi/create-note
 | 
						|
Authorization: {{authToken}}
 | 
						|
Content-Type: application/json
 | 
						|
 | 
						|
{
 | 
						|
  "parentNoteId": "{{parentNoteId}}",
 | 
						|
  "title": "Hello",
 | 
						|
  "type": "text",
 | 
						|
  "content": "Hi there!"
 | 
						|
}
 | 
						|
 | 
						|
> {%
 | 
						|
client.global.set("createdNoteId", response.body.note.noteId);
 | 
						|
client.global.set("createdBranchId", response.body.branch.branchId);
 | 
						|
%}
 | 
						|
 | 
						|
###
 | 
						|
 | 
						|
GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
 | 
						|
Authorization: {{authToken}}
 | 
						|
 | 
						|
> {%
 | 
						|
client.assert(response.status === 200);
 | 
						|
client.assert(response.body.noteId == client.global.get("createdNoteId"));
 | 
						|
client.assert(response.body.attributes.length == 1);
 | 
						|
client.assert(response.body.attributes[0].attributeId == client.global.get("createdAttributeId"));
 | 
						|
%}
 |