# API | Eigenschaften die unter Spezifikationen gelistet sind auf weiteren Artikel anwenden

**URL:** <https://forum.shopware.com/t/api-eigenschaften-die-unter-spezifikationen-gelistet-sind-auf-weiteren-artikel-anwenden/89673>\
**Category:** Shopware 6 (German)\
**Tags:** general, programming\
**Created:** [9. August 2021 um 17:30 UTC](https://forum.shopware.com/t/api-eigenschaften-die-unter-spezifikationen-gelistet-sind-auf-weiteren-artikel-anwenden/89673 "2021-08-09T17:30:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![s-a](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@s-a](https://forum.shopware.com/u/s-a)\
**Post date:** [9. August 2021 um 17:30 UTC](https://forum.shopware.com/t/api-eigenschaften-die-unter-spezifikationen-gelistet-sind-auf-weiteren-artikel-anwenden/89673/1 "2021-08-09T17:30:56Z")

</div>

Wie füge ich bestehende Spezifikationen zu einem anderen Artikel über die API hinzu?

Hier mein Versuch:

```auto
       {
            "name": "TESTARTICLEV1",
            "productNumber": "TESTV1",
            "stock": 500,
            "taxId": "7b5b2d226c7b4b7bb5239027680b3b1b",
            "price": [
                {
                    "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
                    "net": 199.0,
                    "gross": 245.0,
                    "linked": false,
                    "listPrice": null,
                    "extensions": []
                }
            ],
            "propertyIds": [
                    "07bfb0010ddb43d085e3d163f925676a",
                    "09107202790b455b97524749166fd529",
                    "0bdac2157b4e433b9c9b236331c959f7",
                    "4dff80702390448f87b3b5dec4aa8e22",
                    "5903671c791f46d3b1d1a8c3d42f04d4",
                    "6c3f900e0d3b44e6a292cca291adb595",
                    "866b146f88134088b1c62b3cef892bb7",
                    "8b16a3e8c0314598b7285ec30ffc836a",
                    "94110b6d560b49aa9af7cc6926934f55",
                    "9b976738889a4e8281a1d2e0aa252d38",
                    "a577a6d1dbb2435c8d2ec255aa590ad2",
                    "a598c0c6209e4d60bc8895b55eb9f279",
                    "a5c0fe66368b4ddda523950d28a6275a",
                    "afb86ff47810467bba49d559a78fdbc5",
                    "c0adb2e05ffa4926be09c5c077682410",
                    "db35dcd5ec954f6f9d08a3602d318d8e",
                    "f261eee97fae4120a00f6d6a9e7c8327"
                ]
                
        }

```

Ich bekomme folgenden Fehler wenn ich den API Call durchführe:

```auto
{
    "errors": [
        {
            "code": "FRAMEWORK__WRITE_CONSTRAINT_VIOLATION",
            "status": "400",
            "detail": "This field is write-protected.",
            "template": "This field is write-protected.",
            "meta": {
                "parameters": [
                    "crud",
                    ""
                ]
            },
            "source": {
                "pointer": "/0/propertyIdspropertyIds"
            }
        }
    ]
}

```

Freue mich über jede Antwort.

---

<div class="post-metadata">

**Author:** ![joerg.luebbe](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@joerg.luebbe](https://forum.shopware.com/u/joerg.luebbe)\
**Post date:** [9. August 2021 um 18:47 UTC](https://forum.shopware.com/t/api-eigenschaften-die-unter-spezifikationen-gelistet-sind-auf-weiteren-artikel-anwenden/89673/2 "2021-08-09T18:47:04Z")

</div>

Meinst du die Eigenschaften unter Inhalt =\> Eigenschaften und dann eine Ausprägung davon?  
Ich meine „propertyIds“ ist falsch, es müsste nur „properties“ heißen.

---

<div class="post-metadata">

**Author:** ![s-a](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@s-a](https://forum.shopware.com/u/s-a)\
**Post date:** [9. August 2021 um 19:16 UTC](https://forum.shopware.com/t/api-eigenschaften-die-unter-spezifikationen-gelistet-sind-auf-weiteren-artikel-anwenden/89673/3 "2021-08-09T19:16:21Z")

</div>

@joerg.luebbe Ich meine wenn du im webinterace unter Produkte dann den Reiter Spezifikationen auswählt und dann weiter unten bei Eigenschaften.

Ich habe den Code abgeändert aus „propertyIds“ habe ich „properties“ gemacht. Erhalte jedoch folgenden Fehler:

```auto
{
    "errors": [
        {
            "code": "0",
            "status": "500",
            "title": "Internal Server Error",
            "detail": "Argument 2 passed to Shopware\\Core\\Framework\\Api\\Converter\\ApiVersionConverter::convertPayload() must be of the type array, string given, called in /var/www/clients/client1/web2/web/vendor/shopware/core/Framework/Api/Converter/ApiVersionConverter.php on line 66",
            "meta": {
                "trace": [
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/shopware/core/Framework/Api/Converter/ApiVersionConverter.php",
                        "line": 66,
                        "function": "convertPayload",
                        "class": "Shopware\\Core\\Framework\\Api\\Converter\\ApiVersionConverter",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/shopware/core/Framework/Api/Controller/ApiController.php",
                        "line": 905,
                        "function": "convertPayload",
                        "class": "Shopware\\Core\\Framework\\Api\\Converter\\ApiVersionConverter",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/shopware/core/Framework/Api/Controller/ApiController.php",
                        "line": 776,
                        "function": "executeWriteOperation",
                        "class": "Shopware\\Core\\Framework\\Api\\Controller\\ApiController",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/shopware/core/Framework/Api/Controller/ApiController.php",
                        "line": 452,
                        "function": "write",
                        "class": "Shopware\\Core\\Framework\\Api\\Controller\\ApiController",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/symfony/http-kernel/HttpKernel.php",
                        "line": 157,
                        "function": "create",
                        "class": "Shopware\\Core\\Framework\\Api\\Controller\\ApiController",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/symfony/http-kernel/HttpKernel.php",
                        "line": 79,
                        "function": "handleRaw",
                        "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/symfony/http-kernel/Kernel.php",
                        "line": 199,
                        "function": "handle",
                        "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php",
                        "line": 85,
                        "function": "handle",
                        "class": "Symfony\\Component\\HttpKernel\\Kernel",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/symfony/http-kernel/HttpCache/HttpCache.php",
                        "line": 477,
                        "function": "handle",
                        "class": "Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler",
                        "type": "::"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/symfony/http-kernel/HttpCache/HttpCache.php",
                        "line": 267,
                        "function": "forward",
                        "class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/symfony/http-kernel/HttpCache/HttpCache.php",
                        "line": 283,
                        "function": "pass",
                        "class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/symfony/http-kernel/HttpCache/HttpCache.php",
                        "line": 211,
                        "function": "invalidate",
                        "class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/shopware/core/HttpKernel.php",
                        "line": 178,
                        "function": "handle",
                        "class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/vendor/shopware/core/HttpKernel.php",
                        "line": 81,
                        "function": "doHandle",
                        "class": "Shopware\\Core\\HttpKernel",
                        "type": "->"
                    },
                    {
                        "file": "/var/www/clients/client1/web2/web/public/index.php",
                        "line": 77,
                        "function": "handle",
                        "class": "Shopware\\Core\\HttpKernel",
                        "type": "->"
                    }
                ],
                "file": "/var/www/clients/client1/web2/web/vendor/shopware/core/Framework/Api/Converter/ApiVersionConverter.php",
                "line": 31
            }
        }
    ]
}

```

---

<div class="post-metadata">

**Author:** ![joerg.luebbe](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@joerg.luebbe](https://forum.shopware.com/u/joerg.luebbe)\
**Post date:** [9. August 2021 um 19:39 UTC](https://forum.shopware.com/t/api-eigenschaften-die-unter-spezifikationen-gelistet-sind-auf-weiteren-artikel-anwenden/89673/4 "2021-08-09T19:39:45Z")

</div>

Das ist schon mal besser, und der Fehler den er dir gibt besagt dass er ein Array erwartet, er aber Strings bekommt. Dementsprechend müsste jede ID die du in dem Properties Array übergibst wiederrum ein Array sein. Also so:

```auto
properties: [
// Assoz. Array für erste ID 
 {"id" : "dh39d9s99d...."}, 
// Assoz. Array für zweite ID
 {"id" : "d33999aa9a9a..."}
]

```

Probiers mal so und guck dir hier mal bei Many To Many Associations den 3. Punkt an wo ein Produkt mit Categories verknüpft wird.

> **[Associations](https://shopware.stoplight.io/docs/admin-api/docs/guides/writing-entities/associations.md)**
>
> The Admin API allows you to create several data records simultaneously within one request. This is possible by using associations. For example, when a product is written, the prices can be written at the same time. This is not limited to entities ...

---

<div class="post-metadata">

**Author:** ![s-a](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@s-a](https://forum.shopware.com/u/s-a)\
**Post date:** [9. August 2021 um 19:51 UTC](https://forum.shopware.com/t/api-eigenschaften-die-unter-spezifikationen-gelistet-sind-auf-weiteren-artikel-anwenden/89673/5 "2021-08-09T19:51:12Z")

</div>

@joerg.luebbe Wow, vielen vielen Dank. Es funktioniert.

---

<div class="post-metadata">

**Author:** ![joerg.luebbe](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@joerg.luebbe](https://forum.shopware.com/u/joerg.luebbe)\
**Post date:** [9. August 2021 um 19:53 UTC](https://forum.shopware.com/t/api-eigenschaften-die-unter-spezifikationen-gelistet-sind-auf-weiteren-artikel-anwenden/89673/6 "2021-08-09T19:53:57Z")

</div>

Schön, guck dir die API Doku gern mal weiter an, da kann man viel lernen. Auch die Bulk Operationen über den action/sync Endpoint sind sehr gut und performant. Dort könntest du z.B. mehreren Produkten gleichzeitig mehrere Eigenschaften zuweisen.
