0

I have an attribute manufacturers, it has a value, I want to select them and change which I need using Rest API

I tried sending a request like this

http://magengree/rest/V1/products/attributes/manufacturer/1/options

i got this Response

Response {
    "message": "Request does not match any route."
}

How can I do that ?

1 Answer 1

3

You are accessing wrong URL. Please see the details below.

Get all available options for product attribute

Request Method : GET

Request Link Syntax : <base_url>/rest/V1/products/attributes/<attribute_code>/options

Request Link in your case : http://magengree/rest/V1/products/attributes/manufacturer/options

Add new option for product attribute

Request Method : POST

Request Link Syntax : <base_url>/rest/V1/products/attributes/<attribute_code>/options

Request Link in your case : http://magengree/rest/V1/products/attributes/manufacturer/options

Request Body : JSON(application/json)

{
  "option": 
        {
              "label": "Apple",
              "value": "214",
              "sort_order": 0,
              "is_default": true,
              "store_labels": [
              {
                  "store_id": 0,
                  "label": "Apple3"
              }
              ]
        }
}

Delete any existing option for product attribute

Request Method : DELETE

Request Link Syntax : <base_url>/rest/V1/products/attributes/<attribute_code>/options/<option_id>

Request Link in your case : http://magengree/rest/V1/products/attributes/manufacturer/options/214

Make sure you add Authorization token for all request.

For more information Refer catalogProductAttributeOptionManagementV1 from https://devdocs.magento.com/swagger/

Hope it finds you helpful.

1
  • This will add a new option in that attribute, not update existing options!!
    – Lam
    Feb 14, 2021 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.