shopware / admin-api-reference

Shopware Admin API Reference Documentation
https://shopware.stoplight.io/docs/admin-api
11 stars 7 forks source link

Primary key of Options in `configuratorSettings` elements should just be `id` #44

Closed flowl closed 1 year ago

flowl commented 1 year ago

Go to https://shopware.stoplight.io/docs/admin-api/935c55fbf5072-product-data#configurator-handling

click on javascript

        {
            "productNumber": "random.2",
            "stock": 10,
            "options": [
                { "id": "4053fb11b4114d2cac7381c904651b6b" },   // size:  L
                { "id": "0b9627a94fc2446498ec6abac0f03581" }    // color: red
            ]
        }
    ],
    "configuratorSettings": [
        { "optionId": "0b9627a94fc2446498ec6abac0f03581" },     // color: red
        { "optionId": "4053fb11b4114d2cac7381c904651b6b" },     // size:  L
        { "optionId": "ae821a4395f34b22b6dea9963c7406f2" },     // color: yellow
        { "optionId": "ea14a701771148d6b04045f99c502829" }      // size:  XL
    ]

In the upper array, the primary key of options is just id (looks like a system wide convention) but in this configuratorSettings array, the options suddenly have optionId where I'd expect just id.

I don't find this optionId anywhere in the other references:

https://shopware.stoplight.io/docs/admin-api/5459ab6392f41-create-a-new-property-group-option-resources https://shopware.stoplight.io/docs/admin-api/c515447ad4771-detailed-information-about-a-property-group-option-resource

Isengo1989 commented 1 year ago

@flowl the configuratorSettings are referred to in the property-group-option endpoint under productConfiguratorSettings and are named optionId

2023-08-16_16-43

https://shopware.stoplight.io/docs/admin-api/5459ab6392f41-create-a-new-property-group-option-resources

The documented reference is correct, tested with the latest version:

POST http://production.test/api/product
Accept: application/json
Content-Type: application/json
Authorization: Bearer {{ token }}

{
  "price": [{
    "net": 512.5,
    "gross": 615,
    "linked": true,
    "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca"
  }],
  "stock": 10,
  "productNumber": "random2",
  "name": "random2",
  "taxId": "0189e474ed7c71649b7a46aad30f0780",

  "configuratorGroupConfig": [
    {
      "id": "5193ffa5de8648a1bcfba1fa8a26c02b",
      "representation": "box",
      "expressionForListings": true
    }
  ],
  "children": [
    {
      "productNumber": "random.4",
      "stock": 10,
      "options": [
        { "id": "2bfd278e87204807a890da4a3e81dd90" },
        { "id": "5193ffa5de8648a1bcfba1fa8a26c02b" }
      ]
    }
      ],
  "configuratorSettings": [
    { "optionId": "2bfd278e87204807a890da4a3e81dd90" },     
    { "optionId": "5193ffa5de8648a1bcfba1fa8a26c02b" }
  ]

}

Response code: 204 (No Content); Time: 136ms (136 ms); Content length: 0 bytes (0 B)