go-netbox icon indicating copy to clipboard operation
go-netbox copied to clipboard

Question about pagination

Open pyfontan opened this issue 1 year ago • 1 comments
trafficstars

Hello,

I'm trying to use go-netbox v3.4.5-1 DCIM function DcimDevicesList (https://github.com/netbox-community/go-netbox/blob/v3.4.5-1/netbox/client/dcim/dcim_client.go#L4542). I obtain an object with the first 50 devices and would like to access the next page. What is the correct way to "navigate" through all pages ?

Thank you. Pierre-yves

pyfontan avatar May 24 '24 14:05 pyfontan

Self answering me...

The solution is to use a DcimDevicesListParams object with an Offset parameter and loop on DcimDevicesList method. This offset will start at 0 and will change based on the value of the Next attribute in the response payload returned by DcimDevicesList.

pyfontan avatar Jun 04 '24 10:06 pyfontan

The ListParams functions and Offset parameters no longer exist in the recent codebase, what is the new solution?

tacerus avatar Oct 08 '25 11:10 tacerus