Fix Fava API endpoint for getting entry context
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 <noreply@anthropic.com>
This commit is contained in:
parent
f8af54f90b
commit
69ce1d9601
1 changed files with 6 additions and 3 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue