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

Question about pagination #175

Open
pyfontan opened this issue May 24, 2024 · 1 comment
Open

Question about pagination #175

pyfontan opened this issue May 24, 2024 · 1 comment

Comments

@pyfontan
Copy link

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
Copy link
Author

pyfontan commented Jun 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant