changeset 8100:e97caa8e4dae

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.
author John Rouillard <rouilj@ieee.org>
date Wed, 17 Jul 2024 22:54:28 -0400
parents 98ad6d786bef
children 2244205dd7c4
files CHANGES.txt doc/rest.txt
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Wed Jul 17 00:31:35 2024 -0400
+++ b/CHANGES.txt	Wed Jul 17 22:54:28 2024 -0400
@@ -34,6 +34,9 @@
   roundup-gettext will extract translatable strings from the tracker's
   Python code. If polib is missing, it will print a warning. (Patch
   Marcus Priesch, cleanup to remove python 2 issues, John Rouillard.)
+- issue2551315 - Document use of
+  RestfulInstance.max_response_row_size to limit data returned
+  from rest request.
 
 2024-07-13 2.4.0
 
--- a/doc/rest.txt	Wed Jul 17 00:31:35 2024 -0400
+++ b/doc/rest.txt	Wed Jul 17 22:54:28 2024 -0400
@@ -151,6 +151,28 @@
 observed. Using redis, PostgreSQL, or MySQL for storing ephemeral data
 minimizes the loss.
 
+Limit Size of Returned Data
+---------------------------
+
+When selecting from the database, you can limit the number of rows
+returned by adding the following to `interfaces.py`_::
+
+  from roundup.rest import RestfulInstance
+  RestfulInstance.max_response_row_size = 26
+
+This will limit the setting of ``@page_size`` to 25 (one less than the
+value). If the url includes a ``@page_size`` pagination value greater
+than or equal to the ``max_response_row_size`` you will receive an
+error like::
+
+  {
+      "error": {
+	  "status": 400,
+	  "msg": "Page size 30 must be less than admin limit on query
+      result size: 26."
+      }
+  }
+
 Client API
 ==========
 

Roundup Issue Tracker: http://roundup-tracker.org/