Sync API / UPSERT mit ProductNumber als Unique Key

Hi,

ist die Upsert Funktionalität der Sync API begrenzt auf die Id (UUID) einer Entität oder ist es auch möglich zb. die ProductNumber als uniquekey zu verwenden?

Die Api an sich gibt ja bereits die Fehlermeldung „dublicate entry productNumber“ zurück wenn ich versuche ein Produkt erneut hinzuzufügen, welches die gleiche „productNumber hat“. Wäre es dann nicht auch möglich zu sagen, dass er in diesem Falle ebenfalls updaten soll.

Dies wäre z.B. für ERP Konnektoren sehr funktional, da diese ja in der Regel für jedes Produkt eine SKU haben und über diese auch die Produkte im Shop updaten wollen. So wie es jetzt ist, muss man, wenn man die UPSERT Funktion nutzen möchte, erst einmal über API die (UUID) zu der dazugehörigen productNumber abfragen.

Ist das Möglich oder gibt es eine andere Möglichkeit um ein Produkt Insert/Update durchzuführen mit nur einer Abfrage unter Verwendung der „productNumber“  

 

Über eine Antwort wäre ich sehr dankbar.

Einfacher gefragt, gibt es eine anlogie zu dem useNumberAsId=true parameter aus shopware 5 in der shopware 6 API?

1 „Gefällt mir“

We need a functionality like this - Update by product number. It is far to expensive to do lookup on product id before updating the product when having 100K products in the db.

Hi,
How do yu create your products? We fixed this by creating the uuid of the products by hashing the productnumbers(sku). AS you want to Update your products on that key i suppose they are unique in the DB so creating the uuid with that value as Base value you can later simply use your product number Hash it again and Update on id. No need to search for the id then.

Contact me If needed.

Best regards

1 „Gefällt mir“

Hi Jascha
A short follow up on this one.
After implementing this strategy - we have achieved a huge speed increase. We are now able to process 500K products in 2,5 hrs. Thanks a bunch for your input!!!

1 „Gefällt mir“

Thats great! Thanks for your followup.

Best regards