Netbox API 2.0 pagination #949

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

Originally created by @InsaneSplash on GitHub (May 14, 2017).

Is there a way to set the data returned from a api query not to be paginated? I ended up using limit=10000 to get it to return all results else it only provides the first 50 entries.

http://netbox/api/dcim/devices/?format=json&limit=100000

Originally created by @InsaneSplash on GitHub (May 14, 2017). Is there a way to set the data returned from a api query not to be paginated? I ended up using limit=10000 to get it to return all results else it only provides the first 50 entries. `http://netbox/api/dcim/devices/?format=json&limit=100000`
adam closed this issue 2025-12-29 16:27:11 +01:00
Author
Owner

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

That is currently the recommended approach. It is not possible to pass e.g. limit=0 to disable pagination, because the given integer is passed directly into the ORM query (after sanitization). This is something controlled by the Django REST Framework third party package rather than by NetBox itself.

@jeremystretch commented on GitHub (May 15, 2017): That is currently the recommended approach. It is not possible to pass e.g. `limit=0` to disable pagination, because the given integer is passed directly into the ORM query (after sanitization). This is something controlled by the [Django REST Framework](http://www.django-rest-framework.org/) third party package rather than by NetBox itself.
Author
Owner

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

I've thought about this some more and I don't think it's a road we want to go down. API clients should be expected to handle paging elegantly, making multiple successive requests where necessary to pull down large amounts of data.

It might be prudent to hard-code a maximum limit (e.g. 10,000 objects), but I'll raise that topic on the mailing list and see what folks think.

@jeremystretch commented on GitHub (May 16, 2017): I've thought about this some more and I don't think it's a road we want to go down. API clients should be expected to handle paging elegantly, making multiple successive requests where necessary to pull down large amounts of data. It might be prudent to hard-code a maximum limit (e.g. 10,000 objects), but I'll raise that topic on the mailing list and see what folks think.
Author
Owner

@InsaneSplash commented on GitHub (May 19, 2017):

Thanks. We use Oxidized to query the NetBox API daily to retrieve an updated list of all hosts with primary IP's for configuration backups. The product doesnt offer any intelligence when it comes to managing multiple pages with multiple queries. I think a lot of people hope to use the API to integrate other systems with Netbox, but some are really just using it to get a bulk dump of the data.

just my 2c worth.

@InsaneSplash commented on GitHub (May 19, 2017): Thanks. We use Oxidized to query the NetBox API daily to retrieve an updated list of all hosts with primary IP's for configuration backups. The product doesnt offer any intelligence when it comes to managing multiple pages with multiple queries. I think a lot of people hope to use the API to integrate other systems with Netbox, but some are really just using it to get a bulk dump of the data. just my 2c worth.
Author
Owner

@nickzxcv commented on GitHub (Apr 22, 2018):

Handling the pagination would be easier if NetBox implemented Link headers http://docs.python-requests.org/en/master/user/advanced/#link-headers

@nickzxcv commented on GitHub (Apr 22, 2018): Handling the pagination would be easier if NetBox implemented Link headers http://docs.python-requests.org/en/master/user/advanced/#link-headers
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#949