Mercurial > p > roundup > code
comparison doc/rest.txt @ 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 | 57ef20b6c003 |
| children | 2244205dd7c4 |
comparison
equal
deleted
inserted
replaced
| 8099:98ad6d786bef | 8100:e97caa8e4dae |
|---|---|
| 148 It is worth noting that the rate limit feature may be slightly lossy, | 148 It is worth noting that the rate limit feature may be slightly lossy, |
| 149 meaning that under heavy load, it may miscount and allow more than the | 149 meaning that under heavy load, it may miscount and allow more than the |
| 150 burst count. On slower hardware, errors of up to 10% have been | 150 burst count. On slower hardware, errors of up to 10% have been |
| 151 observed. Using redis, PostgreSQL, or MySQL for storing ephemeral data | 151 observed. Using redis, PostgreSQL, or MySQL for storing ephemeral data |
| 152 minimizes the loss. | 152 minimizes the loss. |
| 153 | |
| 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 } | |
| 153 | 175 |
| 154 Client API | 176 Client API |
| 155 ========== | 177 ========== |
| 156 | 178 |
| 157 The top-level REST url ``/rest/`` will display the current version of | 179 The top-level REST url ``/rest/`` will display the current version of |
