Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
WilliamMarti opened this issue May 30, 2017 · 3 comments
Closed
Labels
type: feature Introduction of new functionality to the application

Comments

@WilliamMarti
Copy link

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

@jeremystretch jeremystretch added the type: feature Introduction of new functionality to the application label May 30, 2017
@jeremystretch
Copy link
Member

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.

@InsaneSplash
Copy link

InsaneSplash commented 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?

@jeremystretch
Copy link
Member

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

lampwins pushed a commit to lampwins/netbox that referenced this issue Oct 13, 2017
…nation in API requests; added MAX_PAGE_SIZE configuration setting
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

3 participants