Background
The GET /v3/harvests endpoint currently supports only an rdi filter and basic offset pagination (skip/limit). The API client's list_harvests() method has been updated to the target signature but raises NotImplementedError until the server supports the required features.
Required server-side changes
1. Status filter
Add an optional status query parameter:
GET /v3/harvests?status=RUNNING
GET /v3/harvests?status=FAILED&rdi=my-rdi
Accepted values: RUNNING, COMPLETED, FAILED, CANCELLED.
2. Guaranteed newest-first sort order
Results must be sorted by started_at descending (newest first). The current CouchDB query order is unspecified. A dashboard showing "recent harvests" depends on this guarantee.
Target API client signature
async def list_harvests(
self,
rdi: str | None = None,
status: HarvestStatus | None = None,
limit: int = 20,
offset: int = 0,
) -> list[HarvestResult]:
...
Use case
A middleware dashboard (Django app) will display a list of recent harvest runs with status indicators. Clicking a run shows the detail view. For this:
- The list must be ordered newest-first so the dashboard can show the last N runs.
- Status filtering enables dedicated views (e.g. "all currently running harvests", "failed harvests today").
Affected server-side code
| File |
Change |
middleware/api/src/middleware/api/api/v3/harvests.py |
Add status query param; enforce sort order |
middleware/api/src/middleware/api/business_logic/harvest_manager.py |
Pass status filter to doc store |
middleware/api/src/middleware/api/document_store/__init__.py |
Add status to list_harvests signature |
middleware/api/src/middleware/api/document_store/couchdb.py |
CouchDB query: filter by status, sort by started_at DESC |
Once implemented, remove the NotImplementedError from api_client.list_harvests() and add the query parameters to the HTTP call.
Background
The
GET /v3/harvestsendpoint currently supports only anrdifilter and basic offset pagination (skip/limit). The API client'slist_harvests()method has been updated to the target signature but raisesNotImplementedErroruntil the server supports the required features.Required server-side changes
1. Status filter
Add an optional
statusquery parameter:Accepted values:
RUNNING,COMPLETED,FAILED,CANCELLED.2. Guaranteed newest-first sort order
Results must be sorted by
started_atdescending (newest first). The current CouchDB query order is unspecified. A dashboard showing "recent harvests" depends on this guarantee.Target API client signature
Use case
A middleware dashboard (Django app) will display a list of recent harvest runs with status indicators. Clicking a run shows the detail view. For this:
Affected server-side code
middleware/api/src/middleware/api/api/v3/harvests.pystatusquery param; enforce sort ordermiddleware/api/src/middleware/api/business_logic/harvest_manager.pystatusfilter to doc storemiddleware/api/src/middleware/api/document_store/__init__.pystatustolist_harvestssignaturemiddleware/api/src/middleware/api/document_store/couchdb.pystarted_atDESCOnce implemented, remove the
NotImplementedErrorfromapi_client.list_harvests()and add the query parameters to the HTTP call.