Skip to content

Commit 8f5ae0a

Browse files
committedJul 17, 2019
Update readme.
1 parent 42770b8 commit 8f5ae0a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
 

‎README.md

+30
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,36 @@ ActiveResource is threadsafe as of version 4.1 (which works with Rails 4.x and a
365365

366366
If you were previously using Shopify's [activeresource fork](https://github.com/shopify/activeresource) then you should remove it and use ActiveResource 4.1.
367367

368+
## Pagination
369+
370+
Pagination can occur in one of two ways.
371+
372+
Page based pagination
373+
```ruby
374+
page = 1
375+
products = ShopifyAPI::Product.find(:all, params: { limit: 50, page: page })
376+
process_products(products)
377+
while(products.count == 50)
378+
page += 1
379+
products = ShopifyAPI::Product.find(:all, params: { limit: 50, page: page })
380+
process_products(products)
381+
end
382+
```
383+
384+
Page based pagination will be deprecated in the `2019-10` API version, in favor of the second method of pagination:
385+
386+
[Relative cursor based pagination](https://help.shopify.com/en/api/guides/paginated-rest-results)
387+
```
388+
products = ShopifyAPI::Product.find(:all, params: { limit: 50 })
389+
process_products(products)
390+
while products.next_page?
391+
products = products.fetch_next_page
392+
process_products(products)
393+
end
394+
```
395+
396+
Relative cursor pagination is currently available for all endpoints using the `unstable` API version.
397+
368398
## Using Development Version
369399

370400
Download the source code and run:

0 commit comments

Comments
 (0)