# Admin-API: Produkt mit Varianten anlegen

**URL:** <https://forum.shopware.com/t/admin-api-produkt-mit-varianten-anlegen/68558>\
**Category:** Allgemein\
**Created:** [23. Juli 2020 um 16:31 UTC](https://forum.shopware.com/t/admin-api-produkt-mit-varianten-anlegen/68558 "2020-07-23T16:31:43Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![Dolce](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@Dolce](https://forum.shopware.com/u/Dolce)\
**Post date:** [10. Mai 2021 um 10:57 UTC](https://forum.shopware.com/t/admin-api-produkt-mit-varianten-anlegen/68558/21 "2021-05-10T10:57:51Z")

</div>

@ [FloC3](https://forum.shopware.com/u/FloC3)

Ich wollter mich bei Ihnen erkundigen, ob Sie, nach Ihrem Varianten auf ein Produkt anlegen, neben dem POST, auch einen PATCH erfolgreich auslösen konnten.

Denn das Anlegen eines Artikels mit POST konnte auch ich nun nach langer Übung mit Ihrem Lösungsansatz lösen.  
Leider kann ich Ihren Lösungsansatz nur dann verwenden, wenn Sie einen neuen Artikel mit Varianten in einem Aufwisch erstellen.

Wie muss ich das JSON anpassen, damit ich auch im nachhinein auf einen bestimmten Artikel, welcher bereits in Shopware verfügbar ist, eine zusätzliche Variante mittels REST API anlegen kann? Können Sie mir als Antwort, ein funktionales JSON reinstellen, mit welchem ein Child angelegt werden kann?

Ich kriege es mit dem PATCH einfach nicht gebacken…

Beste Grüsse

Mein JSON:

> {  
> „properties“ : [  
> {  
> „id“ : „dee3b8bac6fe48a094f7abf465a6c981“,  
> „group“ : {  
> „id“ : „0564b6aa5b3243be8c5de32e294460f0“  
> }  
> },  
> {  
> „id“ : „05556717d8844f74832024e34d48a028“,  
> „group“ : {  
> „id“ : „0564b6aa5b3243be8c5de32e294460f0“  
> }  
> }  
> ],  
> „configuratorSettings“:[  
> {  
> „productId“:„3af35b5a5d2d481781b90bb1d656fb45“,  
> „optionId“:„05556717d8844f74832024e34d48a028“,  
> „groupId“:„0564b6aa5b3243be8c5de32e294460f0“  
> },  
> {  
> „productId“:„3af35b5a5d2d481781b90bb1d656fb45“,  
> „optionId“:„dee3b8bac6fe48a094f7abf465a6c981“,  
> „groupId“:„0564b6aa5b3243be8c5de32e294460f0“  
> }  
> ],  
> „children“ : [  
> {  
> „parentId“ : „3af35b5a5d2d481781b90bb1d656fb45“,  
> „name“ : „PA-000510BL.1“,  
> „taxId“ : „af025cd966624f0da05b3cbae05a5c18“,  
> „stock“ : 45,  
> „price“ : [  
> {  
> „net“ : 1,  
> „gross“ : 14.16,  
> „currencyId“ : „3457945d1172408ca7e66cfc411ded68“,  
> „linked“ : true  
> }  
> ],  
> „manufacturerId“ : „38904fb2d48546779bd47ea57e3e327b“,  
> „productNumber“ : „PA-000510BL.1“,  
> „options“ : [  
> {  
> „id“ : „dee3b8bac6fe48a094f7abf465a6c981“,  
> „group“ : {  
> „id“ : „0564b6aa5b3243be8c5de32e294460f0“  
> }  
> }  
> ]  
> },  
> {  
> „parentId“ : „3af35b5a5d2d481781b90bb1d656fb45“,  
> „name“ : „PA-000510BL.2“,  
> „taxId“ : „af025cd966624f0da05b3cbae05a5c18“,  
> „stock“ : 45,  
> „price“ : [  
> {  
> „net“ : 1,  
> „gross“ : 14.16,  
> „currencyId“ : „3457945d1172408ca7e66cfc411ded68“,  
> „linked“ : true  
> }  
> ],  
> „manufacturerId“ : „38904fb2d48546779bd47ea57e3e327b“,  
> „productNumber“ : „PA-000510BL.1“,  
> „options“ : [  
> {  
> „id“ : „dee3b8bac6fe48a094f7abf465a6c981“,  
> „group“ : {  
> „id“ : „0564b6aa5b3243be8c5de32e294460f0“  
> }  
> }  
> ]  
> }  
> ]  
> }

---

<div class="post-metadata">

**Author:** ![mson](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@mson](https://forum.shopware.com/u/mson)\
**Post date:** [9. August 2021 um 12:23 UTC](https://forum.shopware.com/t/admin-api-produkt-mit-varianten-anlegen/68558/22 "2021-08-09T12:23:14Z")

</div>

Danke, bester Forenpost ever! 😄 Das hat mir sehr viel Zeit erspart. Danke!

---

<div class="post-metadata">

**Author:** ![reneSchu](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@reneSchu](https://forum.shopware.com/u/reneSchu)\
**Post date:** [3. November 2022 um 06:07 UTC](https://forum.shopware.com/t/admin-api-produkt-mit-varianten-anlegen/68558/23 "2022-11-03T06:07:38Z")

</div>

Guten Morgen,  
das ist wirklich der beste Post zu diesem Thema. Aber ich bekomme es trotzdem nicht hin. Mir wird es im FrontEnd einfach nicht angezeigt. Was mache ich falsch?

```auto
{ 
	"write-product": 
	{ 
		"entity": "product", 
		"action": "upsert",  
		"payload": [ 
			{
				"id": "17cf3bac8966cc4de52aa557f59e5fd3",
				"active": true,
				"deliveryTimeId": "1e04777cb17d4396b424129b2d8e3a79",
				"description": "Produktbeschreibung",
				"ean": null,
				"featureSetId": null,
				"manufacturerId": null,
				"manufacturerNumber": null,
				"minPurchase": 1,
				"name": "Produktname",
				"productNumber": "Nummer",
				"releaseDate": "2022-09-28T14:12:18.03",
				"stock": 999999,
				"taxId": "2842fd17d5a7424795853e7fe7072448",
				"price":[
					{
						"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
						"net": 13.77,
						"gross": 16.39,
						"linked": false
					}
				],
				"categories":[
					{ 
						"id":"648875017ed54637a41c8c1f972c239f",
						"name":"Kategoriename"
					}
				],
				"configuratorSettings": [
					{ 
						"productId": "17cf3bac8966cc4de52aa557f59e5fd3",
						"optionId": "2ab9df7d2dd94ad38eb53cf7dcf16e56" 
					},
					{ 
						"productId": "17cf3bac8966cc4de52aa557f59e5fd3",
						"optionId": "0fcf784970ea448bac1f7db542df9b86" 
					},
					{ 
						"productId": "17cf3bac8966cc4de52aa557f59e5fd3",
						"optionId": "0014aa7dc0b644b78cd4b39193f580b4" 
					}
				],
				"properties": [
					{ 
						"groupId":"ca74efd59b5545f2b4e4f532c217b2ce",
						"name": "1,0 m" 
					},
					{ 
						"groupId":"fa7f63d697d44684a5bb74ba5a73d3c7",
						"name": "2,0 mm" 
					},
					{ 
						"groupId":"a431bc98fe0149c3bf3ececf629e9740",
						"name": "Material" 
					}
				],
				"visibilities": [
					{
						"id": "17cf3bac8966cc4de52aa557f59e5fd3",
						"salesChannelId": "840a0403b56240b6a11502af1d46521e",
						"visibility": 30
					}
				],
				"coverId": "0f9ab99638bd0ea5e907234bf425819e", 
				"cover": 
				{ 
					"mediaId": "0f9ab99638bd0ea5e907234bf425819e" 
				}, 
				"media": [
					{ 
						"media": 
						{ 
							"id": "0f9ab99638bd0ea5e907234bf425819e", 
							"position": 0, 
							"mediaFolderId": "d8f460870e454c0bbca540614ca30029",
							"alt": "Bildname", 
							"description": "Bildbeschreibung", 
							"title": "Bildtitel" 
						} 
					}
				],
				"children": [ 
					{
						"id": "25c8876fb7577cad78df7539737d25ce",
						"active": true,
						"deliveryTimeId": "1e04777cb17d4396b424129b2d8e3a79",
						"description": "Beschreibung Kindelement",
						"ean": null,
						"featureSetId": null,
						"manufacturerId": null,
						"manufacturerNumber": null,
						"minPurchase": 1,
						"name": "Name Kindelement",
						"productNumber": "Nummer Kindelement",
						"releaseDate": "2022-09-16T14:14:31.41",
						"stock": 999999,
						"taxId": "2842fd17d5a7424795853e7fe7072448",
						"price":[
							{
								"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
								"net": 82.63,
								"gross": 98.33,
								"linked": false
							}
						],
						"categories":[
							{ 
								"id":"648875017ed54637a41c8c1f972c239f",
								"name":"Kategoriename"
							}
						],
						"configuratorSettings": [
							{ 
								"productId": "25c8876fb7577cad78df7539737d25ce",
								"optionId": "b224173313cb4f8da03578ef83702751" 
							},
							{ 	
								"productId": "25c8876fb7577cad78df7539737d25ce",
								"optionId": "0fcf784970ea448bac1f7db542df9b86" 
							},
							{ 
								"productId": "25c8876fb7577cad78df7539737d25ce",
								"optionId": "0014aa7dc0b644b78cd4b39193f580b4" 
							}
						],
						"properties": [
							{ 
								"groupId":"ca74efd59b5545f2b4e4f532c217b2ce",
								"name": "6,0 m" 
							},
							{ 
								"groupId":"fa7f63d697d44684a5bb74ba5a73d3c7",
								"name": "2,0 mm" 
							},
							{ 
								"groupId":"a431bc98fe0149c3bf3ececf629e9740",
								"name": "Material" 
							}
						],
						"parentId": "17cf3bac8966cc4de52aa557f59e5fd3",
						"options": [
							{ 
								"id":"b224173313cb4f8da03578ef83702751",
								"group": {
									"id":"ca74efd59b5545f2b4e4f532c217b2ce"}
								},
								{ 
								"id":"0fcf784970ea448bac1f7db542df9b86",
								"group": {
									"id":"fa7f63d697d44684a5bb74ba5a73d3c7"}
								},
								{ 
								"id":"0014aa7dc0b644b78cd4b39193f580b4",
								"group": {
									"id":"a431bc98fe0149c3bf3ececf629e9740"
								}
							}
						],
						"visibilities": [
							{
								"id": "25c8876fb7577cad78df7539737d25ce",
								"salesChannelId": "840a0403b56240b6a11502af1d46521e",
								"visibility": 30
							}
						],
						"media": [
							{ 
								"media": { 
									"id": "fba6e74294488b554aa88f7dcf6f38f2", 
									"position": 0, 
									"mediaFolderId": "d8f460870e454c0bbca540614ca30029",
									"alt": "Bildname Kindelement", 
									"description": "Beschreibung Kindelement", 
									"title": "Bildtitel Kindelement" 
								} 
							}
						]
					}
				]
			}
		] 
	} 
}

```

Danke für die Hilfe!  
René

[Vorherige Seite](https://forum.shopware.com/t/admin-api-produkt-mit-varianten-anlegen/68558.md?page=1)
