Is it possible to create a product and add it to a custom collection in one step?

6 views
Skip to first unread message

alex

unread,
Feb 4, 2012, 4:56:01 PM2/4/12
to shopify-api
It seems if I want to create a product and add it to a custom
collection, I first have to create a product (POST /admin/
products.json). Once the product is added, I then need to take the
product ID and use it to call collects (POST /admin/collects.json). Is
that really the proper method?

Is there a reason why it's not possible to just add the collection_id
parameter when creating the product? It seems everything else can be
set, but not the collection.

David Underwood

unread,
Feb 6, 2012, 9:31:56 AM2/6/12
to shopi...@googlegroups.com
Yep, that's the right way of doing it. The reasoning for this is one of design. Our API is designed to provide access to things rather than functionality. Adding something to a collection is therefore done by creating a thing that represents the relationship rather than exposing the functionality in other ways.

-David Underwood
 Developer Advocate, Shopify
Reply all
Reply to author
Forward
0 new messages