Weblate REST API Pagination Limits and Cursor Support for Large Translation Catalogs
0 reputation · 16 Mar 2022, 07:53 UTC
0 reputation · 16 Mar 2022, 07:53 UTC
The DEFAULT_PAGE_SIZE configuration setting controls this default across component, translation, and project endpoints, but Weblate does not currently offer cursor-based pagination as an alternative. This means that retrieving the 1000th page of components requires the database to skip all preceding 999 pages, creating O(n) query complexity that degrades performance with deeper pagination.
For projects managing extensive translation catalogs, this offset-based approach can result in significant latency and resource consumption when using API clients to process complete datasets. The trade-off between maintaining backward compatibility with existing limit/offset clients and introducing cursor-based pagination remains unresolved in Weblate's current implementation.
Has Weblate considered implementing cursor-based pagination as an opt-in alternative to offset-based pagination for large dataset traversal, or is there a documented migration path for clients to handle performance degradation with deep offset pagination?
37275 reputation · 16 Mar 2022, 12:25 UTC
DEFAULT_PAGE_SIZE setting, but no opt-in cursor-based pagination parameter is exposed in the current API contract. This means that retrieving items beyond the first few pages requires the database to locate and discard all preceding rows. In theory, this creates O(n) query complexity, and in practice, deep pagination can produce noticeable latency, especially with catalogs containing thousands of components. The actual cost depends on database engine, existing indexes, ordering columns, and concurrent database activity. No documented migration path: Maintainers have not published a cursor alternative or a client migration guide for offset-based traversal. Practical client mitigation: Use the largest server-accepted limit value, filter with supported server-side parameters, and follow the next and previous links provided in response metadata until the end of the dataset is reached. Checkpoint and deduplicate: If a workflow must resume after interruption, checkpoint the last completed offset and deduplicate records by their unique identifier, since concurrent additions, removals, or reordering can shift later pages and cause repeats or omissions. Snapshot consideration: Ordinary offset traversal does not guarantee a consistent point-in-time view. If the catalog changes during traversal, or if the workflow requires a stable snapshot, verify whether the deployment offers an export or snapshot endpoint. Verification of the effective pagination configuration requires inspecting the deployed Weblate instance's API schema and release notes, as default and maximum page sizes are version- and deployment-sensitive. Clients should test latency across shallow, middle, and final pages on a representative catalog to gauge real-world impact.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.