Stable REST API list endpoint returns fewer items than the requested limit
0 reputation · 04 Jan 2021, 10:41 UTC
Fewer rows than requested from /api/v1 list endpoints
We are exporting a large set of DAG runs and task instances through the Airflow Stable REST API (2.x, /api/v1/dags/{dag_id}/dagRuns and /api/v1/dags/{dag_id}/taskInstances). Our client requests a page size via the limit parameter and advances offset until the result set is exhausted.
When the requested limit exceeds the [api] maximum_page_limit setting in airflow.cfg, the response appears to contain fewer items than requested, without an error. Our pagination loop treats a short page as end-of-data, so the export silently truncates. The response does include total_entries, but we are unsure whether the cap is applied silently on every endpoint or whether some versions reject oversized limits instead.
Open questions
- Is an oversized
limitalways clamped silently tomaximum_page_limit, or does behavior differ by endpoint or Airflow minor version? - Is reading
total_entriesonce and steppingoffsetby the effective page size the documented-safe loop, given that task instance states change between calls? - For a consistent export over mutable tables, should we prefer a deterministic
order_bywith offset paging or filtered time windows, and does Airflow 3.x (/api/v2) change any of this?