New max_results_per_page setting applied to all results


#1

We just added a new setting:

# config/settings.yml
:api:
  :max_results_per_page: 1000

If you were using the unreleased master revision of ManageIQ, this replaces the :metrics_default_limit and :event_streams_default_limit settings.

It also accompanies a new change applied to all collections - effectively limiting the result set for all GET/index requests to 1000 records by default.

For small result sets (< max_results_per_page) this should not matter, but it will add a top-level "links" node to the response as you would see when using pagination (i.e. specifying limit and offset params). It will return the links for "self", "first", and "last".

For large result sets (> max_results_per_page), results will be paginated and you will only get back the first max_results_per_page in the response. Similarly to above, you’ll see a "links" top level node, but with added links to "next" ("previous" will be omitted since the offset will be 0 by default). You’ll need to follow the "next" link recursively until you have worked through the entire result set.

You may still apply an arbitrary page size (using limit) as before. However, if you try to use a limit that exceeds the max_results_per_page, it will be ignored and the default setting will be applied instead.

If the default value for max_results_per_page does not meet your needs, you are free to change it. It is recommended however that you do not set it to some arbitrarily large number in an effort to circumvent this feature - it’s designed to prevent excessive load, and certainly requesting millions of records (which would be quite easy to do with the metric rollups/event streams APIs) could result in a DoS attack, whether intended or not.