0

I've been using the Magento API for a while now, and create products via it, as I am now using 'Option' in a dropdown I want to populate it if the option is not found....

As such, I am using the following JSON:

{
  "option": {
    "label": "14",
    "value": "14",
    "sort_order": 0,
    "is_default": true,
  }
}

Looking at the swagger document, this should be accepted! I'm posting to the following URL:

/index.php/rest/V1/products/attributes//options

I get the following error:

{"message":"%fieldName is a required field.","parameters":{"fieldName":"option"}}

But, I'm specifying option in the JSON.

Appreciate any help.

1
  • Hello toby have youళ checked my answer ? Commented Sep 29, 2018 at 6:17

1 Answer 1

0

Your url is in-correct

http://magento.host/rest/V1/products/attributes/{attributeCode}/options
  • method GET

  1. you are missing {attributeCode} in your URL.

    • Parameters - attributeCode is required.
  2. It will Retrieve list of attribute options.

4
  • It striped out my attribute code in between the two slashes! I am putting the attribute in there... Commented Sep 29, 2018 at 7:36
  • great !! it will work follow the steps :) Commented Sep 29, 2018 at 7:37
  • Sorry, I wasn’t clear. My post in here stripped out the attribute code, you can see I have a double // in my original post URL. I put the attribute code between that. So the URL seems correct and the swagger doc seems to say this should be valid. Commented Sep 29, 2018 at 7:41
  • Please share your screen. Commented Sep 29, 2018 at 7:49

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.