RFC: Catalog Import API #3391
Replies: 6 comments 7 replies
-
It would be great. |
Beta Was this translation helpful? Give feedback.
-
Yes. Yes, definitively yes! The current way to import products requires too much technical shopware database knowledge. We had to implement whole flows to read different product states (stock, media, prices, variants, categories) in order to build the payload for updating a single product. While we didn't encounter too many issues, this process was still flawed, performance heavy, and it opened the door to race conditions, maintenance bugs, and other issues. For the feature we'd expect a few cases. First and most important is the data structure. It should be possible to replace (no addition) product categories, properties, etc. with the product payload. For example:
This should replace previous property assignment. No more addition. Shopware should figure out internally which entries to remove and add. Having an empty array will remove all options. Not providing the field "properties" should not touch properties. If possible, avoid using uuids and introduce a unique code for entities. This field could be automatically set when creating the entity based on entity name (e.g. Color option "Red" => "red"). There are multiple benefits with a unique code. Payload is smaller, and monitoring, logging, error debugging is more comfortable, since we see directly which options have been used instead of finding each option via uuid first. This is currently time consuming because there are uuids in product everywhere: taxId, currencyId, deliveryTimeId, categoryIds, streamIds, optionIds, propertyIds, cmsPageId, tagIds, coverId, mediaIds, featureSetId, visibilities. After that the next pain point would be product media. When importing a buyable product, we'd expect to have all required information in frontend inclusive images. However, managing product media is currently difficult for multiple reasons:
I believe there can be still other improvements, for example when it comes to product type structure (standalone product, main product with variants or options, rules, etc....). But when those issues have been addressed, it would make our live a lot easier. Improved error handling and async import would be nice features too. Having this should be already way friendlier to developers who do not know the internal entity structure. Thank you for your efforts! |
Beta Was this translation helpful? Give feedback.
-
Yes, please! We built a middleware connecting different ERP systems to the Shopware API. We currently use batches of 100 products sent to the batch / sync API. The articles contain around 30 properties and each around 4-8 variants. Sending 100 products with all properties etc. to the sync API results in devastating 34.000 MySQL queries even, when MQ-based indexing is enabled by header. The problem is that for every changes entity / relation a Having an dedicated and easier endpoint for a lean product catalogue import with the aim to improve both performance and ease of the product sync would be great! |
Beta Was this translation helpful? Give feedback.
-
We already have a working prototype for the "catalog import api". You can check it at : https://github.com/mothership-gmbh/sw6-simple-api. Our format is pretty similar to what you have proposed:
And for images, our implementation can also solve all current issues with the complexity of handling them. Tell us, how we can support you here :)
|
Beta Was this translation helpful? Give feedback.
-
There is some pre-existing work for resolving entities without UUIDs, see https://github.com/shopware/shopware/blob/v6.5.6.0/tests/unit/Core/Framework/Api/Sync/SyncFkResolverTest.php and https://github.com/shopware/shopware/blob/v6.5.6.0/src/Core/Framework/Api/Sync/SyncFkResolver.php. Liking the proposal so far! |
Beta Was this translation helpful? Give feedback.
-
The Link to https://github.com/mothership-gmbh/sw6-simple-api/settings is public now :) |
Beta Was this translation helpful? Give feedback.
-
Change description
Effort
High
Description
Our current API for importing entities is very flexible, however:
Resulting in increased effort to build and maintain middlewares.
We want to provide an HTTP API and a PHP API for importing catalog related entities independent of the database schema.
And reduce the amount of implementation details developers have to know about when integrating Shopware within existing
systems e.g., ProductVisibility, ProductMedia Entities, Media creation, errors, etc.
Benefit
Break strategy
No expected breaks
Please see the full ADR for information regarding the API, specifications, error handling and so on.
Feedback
We are asking for feedback to understand the perceived value of this potentially large undertaking. Specific items we are interested in:
Beta Was this translation helpful? Give feedback.
All reactions