this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update API documentation to match current implementation

- Fix node update endpoint documentation to show correct request/response format
- Add new DELETE /api/v1/nodes/{id}/properties/{key} endpoint documentation
- Update error response format to match actual implementation
- Fix all example curl commands to use simple property format
- Add examples for node update and property deletion
- Update algorithm request formats to use simple ID format
- Document label replacement vs property merging behavior
- Change delete node response to show 204 No Content status

All documentation now accurately reflects the working API implementation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

+83 -39
+83 -39
docs/API.md
··· 97 97 98 98 **PUT** `/nodes/{node_id}` 99 99 100 - Updates an existing node's labels and properties. 100 + Updates an existing node's labels and/or properties. Labels are completely replaced if provided, while properties are merged with existing ones. 101 101 102 102 **Request Body:** 103 103 ```json 104 104 { 105 - "node_id": { 106 - "id": 12345 107 - }, 108 105 "labels": ["Person", "Manager"], 109 - "properties": [ 110 - { 111 - "key": "title", 112 - "value": { 113 - "string_value": "Engineering Manager" 114 - } 115 - } 116 - ] 106 + "properties": { 107 + "title": "Engineering Manager", 108 + "department": "Technology", 109 + "team_size": 8 110 + } 117 111 } 118 112 ``` 119 113 120 114 **Response:** 121 115 ```json 122 116 { 123 - "success": true 117 + "id": 12345, 118 + "labels": ["Person", "Manager"], 119 + "properties": { 120 + "name": "John Doe", 121 + "age": 30, 122 + "title": "Engineering Manager", 123 + "department": "Technology", 124 + "team_size": 8 125 + } 124 126 } 125 127 ``` 126 128 127 - #### Delete Node 129 + **Notes:** 130 + - Labels: If provided, completely replace existing labels 131 + - Properties: If provided, merge with existing properties (new properties are added, existing ones are updated) 132 + - Both `labels` and `properties` fields are optional 133 + 134 + #### Delete Node Property 128 135 129 - **DELETE** `/nodes/{node_id}` 136 + **DELETE** `/nodes/{node_id}/properties/{property_key}` 130 137 131 - Deletes a node from the graph. 138 + Deletes a specific property from a node. 132 139 133 140 **Response:** 134 141 ```json 135 142 { 136 - "success": true 143 + "id": 12345, 144 + "labels": ["Person", "Manager"], 145 + "properties": { 146 + "name": "John Doe", 147 + "age": 30, 148 + "department": "Technology" 149 + } 137 150 } 138 151 ``` 152 + 153 + **Error Response (404):** 154 + ```json 155 + { 156 + "error": "Property 'salary' not found", 157 + "code": 404 158 + } 159 + ``` 160 + 161 + #### Delete Node 162 + 163 + **DELETE** `/nodes/{node_id}` 164 + 165 + Deletes a node from the graph. 166 + 167 + **Response:** 168 + - Status: `204 No Content` 169 + - Body: Empty 139 170 140 171 ### Relationships 141 172 ··· 448 479 449 480 ```json 450 481 { 451 - "error": { 452 - "code": "INVALID_REQUEST", 453 - "message": "Node ID is required", 454 - "details": {} 455 - } 482 + "error": "Node ID is required", 483 + "code": 400 456 484 } 457 485 ``` 458 486 ··· 476 504 -H "Authorization: Bearer <token>" \ 477 505 -d '{ 478 506 "labels": ["Person"], 479 - "properties": [ 480 - {"key": "name", "value": {"string_value": "Alice"}}, 481 - {"key": "age", "value": {"int_value": 25}} 482 - ] 507 + "properties": { 508 + "name": "Alice", 509 + "age": 25 510 + } 483 511 }' 484 512 485 513 curl -X POST http://localhost:3000/api/v1/nodes \ ··· 487 515 -H "Authorization: Bearer <token>" \ 488 516 -d '{ 489 517 "labels": ["Person"], 490 - "properties": [ 491 - {"key": "name", "value": {"string_value": "Bob"}}, 492 - {"key": "age", "value": {"int_value": 30}} 493 - ] 518 + "properties": { 519 + "name": "Bob", 520 + "age": 30 521 + } 494 522 }' 495 523 496 524 # Create friendship ··· 498 526 -H "Content-Type: application/json" \ 499 527 -H "Authorization: Bearer <token>" \ 500 528 -d '{ 501 - "start_node": {"id": 1}, 502 - "end_node": {"id": 2}, 529 + "start_node": 1, 530 + "end_node": 2, 503 531 "rel_type": "FRIENDS", 504 - "properties": [ 505 - {"key": "since", "value": {"string_value": "2023-01-01"}} 506 - ] 532 + "properties": { 533 + "since": "2023-01-01" 534 + } 507 535 }' 508 536 509 537 # Find mutual friends ··· 514 542 "query": "MATCH (a:Person)-[:FRIENDS]-(mutual)-[:FRIENDS]-(b:Person) WHERE a.name = $name1 AND b.name = $name2 RETURN mutual.name", 515 543 "parameters": {"name1": "Alice", "name2": "Bob"} 516 544 }' 545 + 546 + # Update a node 547 + curl -X PUT http://localhost:3000/api/v1/nodes/1 \ 548 + -H "Content-Type: application/json" \ 549 + -H "Authorization: Bearer <token>" \ 550 + -d '{ 551 + "labels": ["Person", "VIP"], 552 + "properties": { 553 + "status": "premium", 554 + "last_seen": "2023-12-01" 555 + } 556 + }' 557 + 558 + # Delete a specific property 559 + curl -X DELETE http://localhost:3000/api/v1/nodes/1/properties/age \ 560 + -H "Authorization: Bearer <token>" 517 561 ``` 518 562 519 563 ### Running Graph Algorithms ··· 524 568 -H "Content-Type: application/json" \ 525 569 -H "Authorization: Bearer <token>" \ 526 570 -d '{ 527 - "start_node": {"id": 1}, 528 - "end_node": {"id": 10}, 529 - "max_depth": 6 571 + "start_node": 1, 572 + "end_node": 10, 573 + "relationship_types": ["FRIENDS", "KNOWS"] 530 574 }' 531 575 532 576 # Run PageRank ··· 534 578 -H "Content-Type: application/json" \ 535 579 -H "Authorization: Bearer <token>" \ 536 580 -d '{ 537 - "nodes": [{"id": 1}, {"id": 2}, {"id": 3}], 581 + "nodes": [1, 2, 3], 538 582 "damping_factor": 0.85 539 583 }' 540 584 ```