Search code examples
apinestedshopwareshopware6

How do i update a nested value via. the API?


How do i update a nested value via. the API? i want to update my custom field custom_product_fields_magento_product_id

Request path: /api/product/f9529c4f40e94fa6ae7439f97090cc9e

Request type: PATCH

Body:

{
    "translated.customFields.custom_product_fields_magento_product_id" : "123"
}

Where am i going wrong? i can easily update product values that arent nested, like "productNumber" : "value"


Solution

  • You can use

    {
        "customFields": {
            "custom_product_fields_magento_product_id":"123"
        }
    }
    

    The value will be automatically saved to translation, the language of which is specified in the request header or in the default language.