magento2: Can not update attribute options label via REST Api.

Preconditions (*)

  1. Magento 2.3.x

Steps to reproduce (*)

  1. Create a dropdown type product attribute from admin.
  2. Add some attribute options.
  3. Save it.
  4. Get admin token by rest request https://i-22554-2-3-develop.instances.magento-community.engineering/rest/V1/integration/admin/token
  5. Now update option label like: URL: https://i-22554-2-3-develop.instances.magento-community.engineering/rest/V1/products/attributes/color/options Request type: POST BODY: { "option": { "value": "4", "store_labels": [ { "store_id": 0, "label": "Yellow2" } ] } }

Expected result (*)

  1. Attribute option label must be update with new label.

Actual result (*)

  1. It creates new option with given label for update.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

You can update option, but you need to mention the “option id” which has the field key “value”.

Endpoint: PUT /rest/all/V1/products/attributes/[your attribute code]

....[in your body json]
"options": [
        {
          "label": "Easy to detach",
          "value": "19013"
}]

After called, go back to your Magento backend, you will see the option is updated but not created.