#Expanding Entity Relations

7 messages · Page 1 of 1 (latest)

opal galleon
#

Hey, sorry if this is a noob question but in the docs there are a lot of endpoints where the response schema lists a field for related entities but mentions that the relation "must be expanded" to return the field. Just wondering how I would expand the relation for an entity. Thanks!

marsh nova
#

could be like this: /store/products?expand=variants,variants.prices

marsh nova
#

Did this help you? 🙂

opal galleon
#

Thanks! I tried it but it didn't seem to work for me. My server's giving me product variants with the base /store/products query but I tried /collections/{collectionId}?expand=products and it didn't work :/

marsh nova
#

Would recommend doing /products?collection_id={collectionId} instead as there can be a lot of products in a collection so doesn't perform that well as the collection grows 🙂

opal galleon
#

Fair enough! Mostly trying to line items back from /cart/{id} though.

marsh nova
#

cart.items is part of the default response for all /store/carts/{id}/* endpoints; anything specific you are missing?