Scenario: Store with 1000 products; need to download them all. Requests for products are limited to a maximum of 250 products per call, and apparently the API may or may not return the "limit" requested. For example, a call with limit=250 may return less than 250 items, from what I've observed. So, to get 1000 products a minimum of 4 calls are needed.
The following requests are issued:
#1 GET /admin/products.xml?limit=250&page=1 (returned the first 250 products 1-250)
#2 GET /admin/products.xml?limit=250&page=2 (returned the next 250 products 251-500)
#3 GET /admin/products.xml?limit=250&page=3 (****returned only 200 products 501-700**)
#4 GET /admin/products.xml?limit=250&page=4 (****what does it return here?**)
So, the question is about pagination on the server, which will define what happens in line #4 above:
1) Does the API perform smart pagination, in which it knows that the previous request returned only 200 products and therefore the next page must return a list starting with product number 701?
or
2) Does it perform blind pagination, in which a request for page 4 will always start with product number 751, regardless of what happened in the last call?
Use the /admin/products/count.json to get the count of all products. Then divide that number by 250 to get the total amount of pages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With