Allow GET requests to pull all data from relevant resource without limits #1004

Closed
opened 2025-12-29 16:27:45 +01:00 by adam · 3 comments
Owner

Originally created by @WilliamMarti on GitHub (May 30, 2017).

Feature Request

Python version: 2.7.12
NetBox version: 2.0.4

When doing a GET request, we must set a limit manually, or use the default of 50, to the amount of data we can get back in return.

Example:
https://netbox.example.com/api/dcim/devices/?limit=5000

Would like to be able to pull all relevant data for a particular resource without a limit. I can work around this by setting a limit far higher than what I know would be reasonable to have, but doesn't seem maintainable to have static values in my code.

In Slack we spoke about have the flag of limit=0 being the signal to pull all data.

Thanks

Originally created by @WilliamMarti on GitHub (May 30, 2017). Feature Request Python version: 2.7.12 NetBox version: 2.0.4 When doing a GET request, we must set a limit manually, or use the default of 50, to the amount of data we can get back in return. Example: `https://netbox.example.com/api/dcim/devices/?limit=5000` Would like to be able to pull _all_ relevant data for a particular resource without a limit. I can work around this by setting a limit far higher than what I know would be reasonable to have, but doesn't seem maintainable to have static values in my code. In Slack we spoke about have the flag of `limit=0` being the signal to pull all data. Thanks
adam added the type: feature label 2025-12-29 16:27:45 +01:00
adam closed this issue 2025-12-29 16:27:45 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 31, 2017):

Note: I have implemented this, but also introduced the MAX_PAGE_SIZE configuration setting which defaults to 1000. Setting this to 0 or None will disable the limit and allow "?limit=0" to return all matching objects.

@jeremystretch commented on GitHub (May 31, 2017): Note: I have implemented this, but also introduced the `MAX_PAGE_SIZE` configuration setting which defaults to 1000. Setting this to 0 or None will disable the limit and allow "?limit=0" to return all matching objects.
Author
Owner

@InsaneSplash commented on GitHub (Jun 28, 2017):

I seem to be getting weird results trying to set the pagination. No matter what I do, it will not display more than 1000 results? (Netbox 2.0.7)

GET /api/dcim/devices/?limit=0
"next": "http://netbox/api/dcim/devices/?limit=1000&offset=1000",
GET /api/dcim/devices/?limit=none
"next": "http://netbox/api/dcim/devices/?limit=50&offset=50",
GET /api/dcim/devices/?limit=10000
"next": "http://netbox/api/dcim/devices/?limit=1000&offset=1000",

Does one still need to modify the MAX_PAGE_SIZE value?

@InsaneSplash commented on GitHub (Jun 28, 2017): I seem to be getting weird results trying to set the pagination. No matter what I do, it will not display more than 1000 results? (Netbox 2.0.7) ``` GET /api/dcim/devices/?limit=0 "next": "http://netbox/api/dcim/devices/?limit=1000&offset=1000", ``` ``` GET /api/dcim/devices/?limit=none "next": "http://netbox/api/dcim/devices/?limit=50&offset=50", ``` ``` GET /api/dcim/devices/?limit=10000 "next": "http://netbox/api/dcim/devices/?limit=1000&offset=1000", ``` Does one still need to modify the MAX_PAGE_SIZE value?
Author
Owner

@jeremystretch commented on GitHub (Jun 28, 2017):

Yep, if you set MAX_PAGE_SIZE=0 in configuration.py, it removes the ceiling when passing ?limit=n in the request.

@jeremystretch commented on GitHub (Jun 28, 2017): Yep, if you set `MAX_PAGE_SIZE=0` in configuration.py, it removes the ceiling when passing `?limit=n` in the request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1004