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

Support Shopify's new cursor-based pagination #83

Open
larskluge opened this issue Jul 9, 2019 · 2 comments · May be fixed by #92
Open

Support Shopify's new cursor-based pagination #83

larskluge opened this issue Jul 9, 2019 · 2 comments · May be fixed by #92

Comments

@larskluge
Copy link
Contributor

See: https://help.shopify.com/en/api/guides/paginated-rest-results

Introduced in API version 2019-07

This version is not backwards compatible; sending the page parameter fails w/ 400 and "page" => "page cannot be passed. See https://help.shopify.com/api/guides/paginated-rest-results for more information."

@balexand
Copy link
Contributor

balexand commented Dec 2, 2019

This is an important feature to me and I'm willing to put in some work to implement this. On April 1, 2020, API Version 2019-04 will be dropped and that will mean that page-based pagination will no longer be available. We'll need to update our apps to use cursor-based pagination by this date.

At a minimum, this lib will need to return the HTTP response headers so that the caller will have access to the Link headers described in https://help.shopify.com/en/api/guides/paginated-rest-results. I propose that we add a headers field to the Shopify.Response struct. Having access to the headers is important for other reasons too, such as having access to the X-Shopify-Shop-Api-Call-Limit header. This week I hope to submit a pull-request for this.

As a separate task, we can create a more convenient API for pagination. I think the best way to do this would be to implement an Enumerable that automatically fetches new pages of results as needed. I've had a great experience using this approach in the past. I'd be happy to contribute a pull-request for this but I may not have time until later this month.

@nsweeting
Copy link
Owner

Regarding adding :headers to the Shopify.Response struct - that would be great. Exactly how I envisioned fixing this issue - just havent had time. A PR would be much appreciated 👍

As a follow up, please feel free to submit an issue + PR for your Enumerable implementation.

@balexand balexand linked a pull request Dec 18, 2019 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants