API Call to Get Products using cURL, Pagination doesn't work

New Member
5 0 0

I have tried this with 2019-07 and today again with 2019-10 with no luck.

Here is my first cURL call

 

!curl --connect-timeout 30 -X GET -i -H 'Content-Type: application/json' -u1234123412341234:5678567856785678 https://mycompany|.myshopify.com/admin/api/2019-10/products.json?limit=1

 

It seems to return the proper information for the first page along with a link as follows:

 

Link: <https://mycompany.myshopify.com/admin/api/2019-10/products.json?limit=1&page_info=ewertyuiowfghjimnb...>; rel="next"

 

When I insert this link as returned into my next cURL call, it doesn't work at all and just keeps returning the same first page information over and over. So I changed the link returned as follows to put the limit=1 at the end and it almost works.

 

!curl --connect-timeout 30 -X GET -i -H 'Content-Type: application/json' -u1234123412341234:5678567856785678 https://mycompany|.myshopify.com/admin/api/2019-10/products.json?page_info=ewertyuiowfghjimnbfk1NDCJ9&limit=1

 

When I run altered link info in my cURL for the second call, it doesn't just give me the next page, it gives me the entire product file, including the products from the first call again.  I have tried every way I can think of.  It is like the limit=1 doesn't work.  I'm at a loss of what to do.  Any ideas?  Thanks in advance for your help.

0 Likes

Hello 

Please reffer below link

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

Making requests to paginated REST Admin API endpoints
https://help.shopify.com

Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Custom Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | Digital Marketing | Site Speed Optimization | Web Development
0 Likes
Highlighted
New Member
5 0 0

Thanks for the link, but I had already read all of that and it doesn't work.  For starters the Link information that is returned is in the wrong order and doesn't match the documentation.  What is returned in the Link is the limit and then the page_info, and the documentation clearly says it must be page_info and then the limit.  I used the link as it is returned and it just keeps downloading the same products over and over.  So I changed the order to match the documentation, but instead of just limiting the call to 1 i.e. limit=1, it returns all the products and not just the next page of products.  It is like it ignores the limit=1.

0 Likes