0

Using Postman, with the following GET request I receive data from my custom product attribute:
rest/V1/products/attributes?&searchCriteria[filterGroups][0][filters][0][field]=attribute_id&searchCriteria[filterGroups][0][filters][0][value]=580

The response looks like this:

"options": [
                {
                    "label": " ",
                    "value": ""
                },
                {
                    "label": "Label 1",
                    "value": "16594"
                },
                {
                    "label": "Label 2",
                    "value": "16597"
                },

Now I need to add a new attribute value including a label and the description.

Here it says it would be possible (now): https://devdocs.magento.com/guides/v2.3/release-notes/release-notes-2-3-4-open-source.html

enter image description here Can anyone help how the body of my POST request should look like? Thanks!

1 Answer 1

0

you can see all all API list in your magento instance by below endpoint.

yourMagento/swagger

ref: https://devdocs.magento.com/guides/v2.3/rest/generate-local.html

enter image description here

on that interface you can pass your access token and get all list of available api request with example.

for your request you need to pass below params in post request.

Request Endpoint: /V1/products/attributes/{attributeCode}/options

Params:

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

Hope this solution help you to complete you task.

Note: Please make it right and add plus to this solution if this solution work for you.

Thank you.

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.