API Display all product data

Highlighted
Tourist
13 0 1

So Currently I am developing an external program for saving my product data using api, and I was wondering how to display all product using product api. since i saw there was a limit of 250 items, so is there any method to display all item without limit? thanks

0 Likes
Highlighted
Shopify Partner
98 0 16

you have to use the page parameter in the api call.

so first call, first page gives you the first (up to) 250 items.

second call, set page to "2", gives you the next 250 items. and so on

how do you know how man pages you will have? first make a get call to /admin/products/count.json and then divide the total number by the limit per page (default: 50, maximum: 250)

Looga.io
1 Like
Highlighted
Excursionist
14 2 0

How to do that?

 

When I am trying to do that not all the products are showing. 

 

When I do the: 

/admin/api/2019-07/products/count.json

 

I am receiving this message: 

{"count":258}

 When I try to the pagination: 

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

 

I am receiving this message: 

{"errors":{"page":"page cannot be passed. See https:\/\/help.shopify.com\/api\/guides\/paginated-rest-results for more information."}}

 

0 Likes
Highlighted
New Member
3 0 0

You cannot use this page parameter its deprecated.

0 Likes
Highlighted
Shopify Partner
14 0 0

You can not use page. 

New way to get result through pagination is cursor based pagination.

See https://shopify.dev/tutorials/make-paginated-requests-to-rest-admin-api 

0 Likes
Highlighted
Excursionist
14 2 0

Yeah! I forgot to close this post: 

I figure out and I am using this:

 

https://key:pass@myaddress.myshopify.com/admin/api/2019-07/products/'.$id.'/variants.json?direction=next&last_id='.$last_id2.'&limit=250
 
where:
 - $id is my product ID
 - $last_id2 is the last VARIANT_ID read in the previous call
 
0 Likes