Skip to content

Commit 3a65411

Browse files
committed
issue2551315 - Allow admin settable max number of rows to be returned by rest interface.
Documented use of RestfulInstance.max_response_row_size to limit data returned from rest request.
1 parent 9d80342 commit 3a65411

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Features:
3434
roundup-gettext will extract translatable strings from the tracker's
3535
Python code. If polib is missing, it will print a warning. (Patch
3636
Marcus Priesch, cleanup to remove python 2 issues, John Rouillard.)
37+
- issue2551315 - Document use of
38+
RestfulInstance.max_response_row_size to limit data returned
39+
from rest request.
3740

3841
2024-07-13 2.4.0
3942

doc/rest.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,28 @@ burst count. On slower hardware, errors of up to 10% have been
151151
observed. Using redis, PostgreSQL, or MySQL for storing ephemeral data
152152
minimizes the loss.
153153

154+
Limit Size of Returned Data
155+
---------------------------
156+
157+
When selecting from the database, you can limit the number of rows
158+
returned by adding the following to `interfaces.py`_::
159+
160+
from roundup.rest import RestfulInstance
161+
RestfulInstance.max_response_row_size = 26
162+
163+
This will limit the setting of ``@page_size`` to 25 (one less than the
164+
value). If the url includes a ``@page_size`` pagination value greater
165+
than or equal to the ``max_response_row_size`` you will receive an
166+
error like::
167+
168+
{
169+
"error": {
170+
"status": 400,
171+
"msg": "Page size 30 must be less than admin limit on query
172+
result size: 26."
173+
}
174+
}
175+
154176
Client API
155177
==========
156178

0 commit comments

Comments
 (0)