Can't get 250 products at once and paginate

Highlighted
New Member
4 0 0

Hi everyone!

 

Trying to understand a problem: if I request GET

 

/admin/api/2019-10/products.json

I receive 50 records, but if I try to raise the limit, using those endpoints:

 

/admin/api/2019-10/products.json?limit=250

/admin/api/2019-10/products.json?limit=250&page=1

/admin/api/2019-10/products.json?limit=250&page=1&since_id=0

I get nothing, zero, nada, zip, zilch products.

 

Here are the X-Request-IDs for some of those calls:

 

8ea75f5f-bfa4-435a-9e95-46d9762c7f6b

16d1b864-a531-4a12-9c0e-d254b21a0199

5ed79cc7-4953-4476-b41d-bfc426afa9ca

 

Thank you

0 Likes
Shopify Partner
1054 116 170

Version 2019-10 doesnt not support page based navigation through the resultset. You must consider switching to cursor based navigation - https://help.shopify.com/en/api/guides/paginated-rest-results. If you still want to use page based navigation you should use version 2019-04 in your URLs instead of 2019-10. The page based navigation will be completely removed in April 2020.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
New Member
4 0 0

My goal here is to download everything, I don't really need "pagination", so I started testing it only using "limit", which is not working by itself. 

 

The documentation for 2019-10 still shows "limit" and "since_id":

 

https://help.shopify.com/en/api/reference/products/product

 

endpoints.png

 

 

 

0 Likes
Shopify Partner
1054 116 170

You can't get all in a single request, you'll have to paginate either way, unless you have less then 250 products. By the way, I have no issues getting 250 products in the results when using limit=250, though it's quite slow and the response weights megs. Are you testing using postman? Or a different client? Do you get a 200 http code in response and an empty JSON response?

 

Maybe that's the client that is cutting off the connection?

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
New Member
4 0 0

I know I can't get all in a single request, that's exactly why I was trying to use limit and since_id.

 

Everything works fine, I can get 50 records on a "query-less" /.../products.json request. But if I add "?limit=250" to the URL I get zero records.

 

Status responses of all requests are 200, even for the requests returning zero records (empty response body). The bigger difference I can spot is in the Content-Type

 

Using /products.json it is "application/json; charset=utf-8"

Using /products.json?limit=250 it is "text/html; charset=utf-8", and the html has a "Continue" link

0 Likes
New Member
4 0 0

To move to the next page I'm now using query exactly the way I receive it back from the API on the "Link" header:

 

/.../products.json?limit=50&page_info=eyJsYXN0X2lkIjo0MzU0OTE3MzY3ODc5LCJsYXN0X3ZhbHVlIjoiSW5kaWEgRWFycmluZ3MiLCJkaXJlY3Rpb24iOiJuZXh0In0

And this doesn't work either. Response status is 200, but the body is empty.

 

X-Request-ID: 099fb4a1-ecbd-4c36-be1f-719f370517b7

0 Likes