mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	ETAPI delete/patch, refactoring
This commit is contained in:
		
							
								
								
									
										74
									
								
								test-etapi/patch-attribute.http
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								test-etapi/patch-attribute.http
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| 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); %} | ||||
|  | ||||
| ### | ||||
|  | ||||
| PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}} | ||||
| Content-Type: application/json | ||||
|  | ||||
| { | ||||
|   "value": "CHANGED" | ||||
| } | ||||
|  | ||||
| ### | ||||
|  | ||||
| GET {{triliumHost}}/etapi/attributes/{{createdAttributeId}} | ||||
|  | ||||
| > {%         | ||||
| client.assert(response.body.value === "CHANGED"); | ||||
| %} | ||||
|  | ||||
| ### | ||||
|  | ||||
| PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}} | ||||
| Content-Type: application/json | ||||
|  | ||||
| { | ||||
|   "noteId": "root" | ||||
| } | ||||
|  | ||||
| > {%  | ||||
|     client.assert(response.status === 400);  | ||||
|     client.assert(response.body.code == "PROPERTY_NOT_ALLOWED_FOR_PATCH"); | ||||
| %} | ||||
|  | ||||
| ### | ||||
|  | ||||
| PATCH {{triliumHost}}/etapi/attributes/{{createdAttributeId}} | ||||
| Content-Type: application/json | ||||
|  | ||||
| { | ||||
|   "value": null | ||||
| } | ||||
|  | ||||
| > {%  | ||||
|     client.assert(response.status === 400);  | ||||
|     client.assert(response.body.code == "PROPERTY_VALIDATION_ERROR"); | ||||
| %} | ||||
		Reference in New Issue
	
	Block a user