Smart Collections Paging Loop (Admin API)

Highlighted
New Member
1 0 0

I've been trying to get all collections from a store using an API key and the route 

/admin/api/{api verison}/smart_collections.json and /admin/api/{api verison}/custom_collections.json

but i keep getting more and more next links (on smart collections) for what seems like forever.

 

So I used the route /admin/api/{api verison}/smart_collections/count.json to get the amount of collections (885) and then I followed the next link until i have accumulated the an amount of collections that is equal to the count.

but when I inspect my results I see that i have just gotten the same (~200) collections over and over again.

The site has more than 200 collections and in fact when I pass the id of one of the missing collections to the route

/admin/api/{api verison}/collections/{collection_id}.json I do get the collection back from the API.

 

Bottom line for some reason instead of paging over my entire collections I just get and endless loop of the same ~200 collections.

 

I'm using NodeJS v10 with native node http libraries to make the http requests. I'm not saving cookies, the only http response header I look at is the "link" header sent by the API.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1040 140 165

Hey @okiano 

 

Are you able to replicate this outside of Node, say via Postman? If so, can you please provide the smart collection ID?

0 Likes