Get (json) list of all products with collections they belong to

Mato1
Visitor
2 0 0

How can I get a list of all products with collections they belong to. The problem is I have ~2000 products and whatever method I try I hit some limitation every time.

Last thing I tried (using Rest API) was first I got list of all collections:

 

/admin/api/2020-01/collection_listings.json

 

 

Then for every collection I tried to get products that belong to that category:

 

/admin/api/2020-01/products.json?collection_id=xxx

 

But this takes ages, is there anything quicker? I also tried GraphQL but limits are too low to be usable for my case.

Any suggestions?

Reply 1 (1)
Kevin_A
Shopify Staff
Shopify Staff
318 42 61

Hey @Mato1 

You mentioned you tried with graphQL but the limits were too low, but are you aware of graphQL bulk operations? This should allow you to query all products with their collections (or vice-versa) and return one large data set. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog