Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Pagination Support #58

Closed
terinjokes opened this issue Apr 14, 2020 · 8 comments
Closed

Pagination Support #58

terinjokes opened this issue Apr 14, 2020 · 8 comments
Milestone

Comments

@terinjokes
Copy link
Contributor

The Cloudflare API is pretty consistent in how it supports pagination. It would be nice to have to support asynchronously fetching new pages.

#34 #37

@terinjokes terinjokes added this to the 3.0.0 milestone Apr 14, 2020
@depombo
Copy link

depombo commented Feb 24, 2021

That would be great!

@ririko5834
Copy link

Can you fetch all DNS records in one request without pagination?

@terinjokes
Copy link
Contributor Author

Not at this time.

@mjpoo
Copy link

mjpoo commented Nov 4, 2021

I would also be very grateful if either there could be larger paging or pagination as at the moment we are having to store all the zone IDs in our own database because zones.browse() only returns the first 20 zones.

@terinjokes
Copy link
Contributor Author

The last parameter, after all the URL parameters and body, is and optional query parameter object, so you should be able to pass { page: 2 }

@mjpoo
Copy link

mjpoo commented Nov 4, 2021

Ohh that is handy @terinjokes . I've tried that out and it works like a charm.
Does that mean that any browse method will accept an options object in the same manner and that we could also pass an options object to a read method after the required parameters? e.g. pageRules.read('abc123', { status: active }).

@terinjokes
Copy link
Contributor Author

All the methods should allow setting query parameters as the last (optional) function parameter, though the browse and read ones are probably the most useful.

@mjpoo
Copy link

mjpoo commented Nov 4, 2021

Thanks for confirming that @terinjokes . The biggest benefit is that I can simply return a named zone pageRules.browse( { name: 'foo.com' } ) effectively using the browse method as a read method.

For the benefit of others here are all the optional parameters you could pass into the zones.browse() method.

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

No branches or pull requests

5 participants