Skip to content

Commit 94c56af

Browse files
jope-bmclaude
andcommitted
feat: Redesign v2 resource endpoints to use entity IDs
Changed v2 resource endpoints to use entity IDs in URL paths instead of file paths, with file_path moved to request bodies when needed. This is consistent with v2's ID-first design principle. New API Design: - GET /v2/projects/{project_id}/resource/{entity_id} - Get content by entity ID - POST /v2/projects/{project_id}/resource - Create resource (file_path + content in body) - PUT /v2/projects/{project_id}/resource/{entity_id} - Update resource (content in body, optional file_path to move) Key Changes: - Uses integer entity IDs in URL paths (not file paths) - File paths are in request/response bodies - More RESTful: POST for create, PUT for update - Supports moving files during update via optional file_path in request body - Returns entity_id in all responses (ResourceResponse schema) Request Schemas: - CreateResourceRequest: {file_path: str, content: str} - UpdateResourceRequest: {content: str, file_path?: str} - ResourceResponse: {entity_id: int, file_path: str, checksum: str, ...} Tests: - Rewrote all 11 v2 resource tests for new ID-based API - Tests cover create, read, update, move, path validation - All tests passing with entity ID validation Benefits: - Stable entity references (IDs don't change when files move) - Cleaner URL structure without path encoding issues - Consistent with other v2 endpoints (knowledge, memory, etc.) - Better separation of concerns (ID for routing, path for storage) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Joe P <joe@basicmemory.com>
1 parent 1a2d073 commit 94c56af

4 files changed

Lines changed: 412 additions & 454 deletions

File tree

0 commit comments

Comments
 (0)