MAX_PAGE_SIZE is not respected correctly on REST API calls #11686

Closed
opened 2025-12-29 21:48:37 +01:00 by adam · 0 comments
Owner

Originally created by @arthanson on GitHub (Oct 3, 2025).

Originally assigned to: @arthanson on GitHub.

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

Originally created by @arthanson on GitHub (Oct 3, 2025). Originally assigned to: @arthanson on GitHub. ### 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
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:48:37 +01:00
adam closed this issue 2025-12-29 21:48:37 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11686