-
Notifications
You must be signed in to change notification settings - Fork 47
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
Pagination headers #17
Comments
We don't include headers with next page details - have a look at the index reference for one of our resources: https://help.shopify.com/api/reference/article#index If you need to fetch all items using pagination write a loop that increments the page param until you don't get anything back. Adding this utility to our client libraries has been discussed so if you make something you'd like to contribute back please open a PR |
I would be interested in working on this. In your opinion would this be a pointer to another active resource object for the next page, or some sort of iterable? |
What I've done in ruby before is create a Does that make sense? |
Yes that makes sense, so to abstract this you would create a new active resource class, maybe collection, that inherits from active resource and know how to fetch the next page? |
Is there anyway to get the headers from the previous call? |
you could store them in a variable before making the next call. I don't think you need to do this though to solve your problem. |
Thanks @kevinhughes27 I don't need to do this, but it prevents me from making un-needed calls. I guess I was somewhat unclear, how do I get the response object from the urllib caller so I can store it? |
How does it prevent you from making un-needed calls? I am not sure how to reach through to urllib you'll have to deep dive the code if thats what you need. |
If the API is following spec rfc988 then the headers send back the next page if present. So if you are on the last page you know not to call again. I can dig through I was just wondering if the active resource call was saving the calls response as state somewhere?
|
Yeah sorry I am not familiar enough with the internals |
Hello,
I am curious about support for pagination headers such as these:
I don't think this exists today, but it would be nice to add next page bindings to the api. Any opinions?
The text was updated successfully, but these errors were encountered: