We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.
Welcome to the commercetools Community!
Featured topics
The latest & greatest from the Community
commercetools Launches Commerce MCP and AI Hub to Make Enterprise Commerce Agent-Ready
1640
commercetools unveils Spring 2025 Compilations to power better experiences, faster growth, and smarter operations
870
New to the Community? Introduce yourself here!
165364
From the Community
Questions from the Community
Import API - variant
Hi, we implemented an import service using the Import API and the system that uses it would send the “masterVariant” flag. When a product variant is initially created, we get NewMasterVariantAdditionNotAllowed error. https://docs.commercetools.com/api/import-export/import-resources#productvariantimport I’m wondering how should we create the master variant then? Import without master variant flag and then run the import again to set the proper master variant? For me this is not very logical and friendly and gives the need for redundant operations (re-running the import with all attributes again) Regards, Drazen
755
Deserializing Subscription Notifications
Hello, we were using commercetools java sdk 17.26.0. We had a handler for the messages where we would send in asn parameter com.commercetools.api.models.message.Message So it would look like public void processMessage(final ServiceBusReceivedMessageContext context){ final BinaryData data = context.getMessage().getBody(); final Message message = data.toObject(Message.class); handler.handle(message);} In handler we would, if needed just cast to the class we new this handler should handle final DiscountedPrice discount = ((StandalonePriceDiscountSetMessage) message).getDiscounted(); With updating to 19.3.0, this is not working anymore because com.commercetools.api.models.message.Message does not have @JsonSubTypes annotation and it just deserializes to com.commercetools.api.models.message.MessageImpl. Only solution I found is to do it with jackson like this JsonUtils.getConfiguredObjectMapper().readValue(context.getMessage().getBody().toString(), StandalonePriceDiscountSetMessage.class) Same thing happened to Change messages where @JsonSubTypes were removed from com.commercetools.api.models.subscription.DeliveryPayload. Now even this does not work, throws an exception, and was working before: final DeliveryPayload payload = context.getMessage().getBody().toObject(DeliveryPayload.class); Here also I have to do it like this now: final DeliveryPayload deliveryPayload = JsonUtils.getConfiguredObjectMapper().readValue(data.toString(), DeliveryPayload.class); My question is, is there any smarter way to deserialize to the specific implementation class now in 19.3.0? Am I missing some method or some helper class or whatever? Because it is strange that something that was working OOTB and pretty much Generic, was now removed. Thanks and best regards, Tomislav Hlevnjak
Preferred way to export all products of a given store
Hi, I want to export product data to an external system. This means: Initially export all products of a given store to the external system After the initial export is finished, sync changes of product data to the external system using subscriptions I was wondering what the recommended way to do the initial full export is, especially with a large amount if products like ~100.000. I checked the documentation and furthermore had a look at the product export template (https://github.com/commercetools/connect-product-export-template/tree/main). The product export template loads all product ids using the the “Query Products assigned to active ProductSelections in a Store” endpoint (https://docs.commercetools.com/api/projects/product-selections#query-products-assigned-to-active-productselections-in-a-store), before retrieving product data with a separate call to the “Get ProductProjection in Store by ID” endpoint (https://docs.commercetools.com/api/projects/productProjections#get-productprojection-in-store) for every single product. This seems like a lot of requests to the API, given a large set of product data with a long execution time for a full export. Furthermore I’m not sure how to handle the problem, that already exported chunks are changed in commercetools, while the export is still running. Yes, I like to use subscriptions to sync changes to the external system, but only after the full export is finished. So, in summary, the question arises for me: what is the best und most performant way to keep a external system in sync with the product data for a given store? Thanks and kind regardsTorben