1

Is there a way to tell Magento 2 to:

  1. Send custom_attribute Label instead of Value;
  2. Auto create option in case the Label doesn't exist yet.

I was able to do it with Magento 1 API, but I can't find a way to do the same using Magento 2.

Rest API endpoint I'm using: PUT http://localhost/rest/V1/products/123456

Body:

    {
      "product": {
        "attribute_set_id": 4,
        "sku": "123456",
        "name": "Name Example",
        "price": 9.99,
        "weight": 5,
        "created_at": "10/3/18, 1:03 PM",
        "updated_at": "10/11/18, 9:55 PM",
        "extension_attributes": {
          "stock_item": {
            "qty": 1,
            "is_in_stock": true,
            "is_qty_decimal": false
          }
        },
        "custom_attributes": [
          {
            "attribute_code": "warranty",
            "value": "6 Months"
          }
        ]
      }
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.