Skip to content

MAX_PAGE_SIZE is not respected correctly on REST API calls #20496

@arthanson

Description

@arthanson

NetBox Edition

NetBox Community

NetBox Version

4.4.2

Python Version

3.10

Steps to Reproduce

  1. Make sure you have about 10 sites or more added into the system.
  2. set the following either in configuration.py or adding a Configuration (admin - system - Configuration History)
    MAX_PAGE_SIZE = 5
    PAGINATE_COUNT = 3
  3. Go to the REST browser for sites api/dcim/sites/ also with limit api/dcim/sites/?limit=30

Expected Behavior

MAX_PAGE_SIZE should be upper limit for number of results returned, so only 5 sites should be returned.

The rules should be:
if MAX_PAGE_SIZE is set:
* if no limit is set return min(MAX_PAGE_SIZE, PAGINATE_COUNT)
* if limit set return min(limit, MAX_PAGE_SIZE)
* if limit = 0 or None return MAX_PAGE_SIZE
if MAX_PAGE_SIZE is not set:
* if no limit is set return PAGINATE_COUNT
* if limit is set return limit
* if limit = 0 return all data

Observed Behavior

MAX_PAGE_SIZE is ignored, it is only applied if you send ?limit=0

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions