Skip to main content

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

Drazen,

 

Thanks for reaching out.  We are reviewing this and will be back in touch with a suggestion.


Hi Drazen,

Unfortunately, the API does not support this in a single request, and as a result, the Import API does not, either. However, the team is considering improving this.

We recommend that you use the following pattern when implementing the Import API.

  1. New product , imported using Product draft with all values being provided in the same batch and import request.

  2. Product updates have been handled by Products

  3. Variant addition and update handled by Product variants and Product variants patch.


This mitigates the issue mostly for new products; however, for existing products, you can run twice as you suggested (with all attributes) or have an application set new masters with the API directly after the import is complete.

Does that help?

Best Regards
Brian

For a quicker response, please use the Support portal for these types of questions.


Thank you for the answer, unfortunately this just confirmed my understanding/worries. 

As a general feedback would say that the Import API is not an ideal approach for importing data as it brings many blockers, edge cases and very high complexity where we need to have many checks/if/else cases when to do what, and my understanding of an Import API would be that it removes that complexity of the native Commercetools API a not that we need to handle al this cases and thinking when and how to handle it. 

Regards, 
Drazen


Hi Drazen,

Thanks for the feedback. I have passed this on to the team.

If you have any more pain points, I would be interested in you sharing them here.

The team is constantly working to eliminate these blockers and edge cases and will seriously consider your feedback.

Best regards
Brian


With the current setup of Import SDK, I don’t see much value than just using the standard API and having control what we import. 

I would look at the Import API as a layer that removes the need to think about each CRUD operation, e.g. ideally we send some data and its either created or updated. 

ProductDraft → good only for initial load only, we also noticed some race conditions here when a source system sends multiple updates in very short time

Product Variant → kind makes sense so that you can import just one variant but again you need to use it in combination with ProductDraft as you can’t just import variants so again multiple different implementations wit different payloads, etc. 

Thank you, 
Regards


Reply