From 69ce1d960119814728026e6386a52fb8c4337527 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Fri, 2 Jan 2026 18:23:18 +0100 Subject: [PATCH] Fix Fava API endpoint for getting entry context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use GET /api/context instead of GET /api/source_slice. Fava's API naming convention means source_slice only supports PUT and DELETE, while context is the correct endpoint for reading entry data. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- fava_client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fava_client.py b/fava_client.py index f7f9983..38e932a 100644 --- a/fava_client.py +++ b/fava_client.py @@ -10,7 +10,9 @@ Fava provides a REST API for: - Querying balances (GET /api/query) - Balance sheets (GET /api/balance_sheet) - Account reports (GET /api/account_report) -- Updating/deleting entries (PUT/DELETE /api/source_slice) +- Getting entry context (GET /api/context) +- Updating entries (PUT /api/source_slice) +- Deleting entries (DELETE /api/source_slice) See: https://github.com/beancount/fava/blob/main/src/fava/json_api.py """ @@ -1098,7 +1100,8 @@ class FavaClient: """ Get entry source text and sha256sum for editing. - Uses /source_slice endpoint which returns the editable source. + Uses /context endpoint which returns the editable source slice. + Note: Fava's API uses get_context for reading, put_source_slice for writing. Args: entry_hash: Entry hash from get_journal_entries() @@ -1117,7 +1120,7 @@ class FavaClient: try: async with httpx.AsyncClient(timeout=self.timeout) as client: response = await client.get( - f"{self.base_url}/source_slice", + f"{self.base_url}/context", params={"entry_hash": entry_hash} ) response.raise_for_status()