0

I have configurable product added, sku KudosConfig. I have added an attributes called kudos_size and kudos_colour which have values of Small, Medium, Large and Green, Pink, Orange respectively. The next step, I thought, was to add the 9 simple products with appropriate attribute value set for both kudos_size and kudos_colour. To do this I am using the following request:

   PUT https://example.com/rest/V1/products/KudosConfigGreenSmall

The body of the request is:

{
  "product":{
    "sku":"KudosConfigGreenSmall ",
    "name":"Kudos Configurable Green Small",
    "price":30.00,
    "status":0,
    "type_id":"simple",
    "attribute_set_id":4,
    "weight":1,
    "custom_attributes":[
      {
        "attribute_code":"kudos_colour",
        "value":"Green"
      },
      {
        "attribute_code":"kudos_size",
        "value":"Small"
      }
    ]
  }

This however returns a http 400 bad request response with message:

Error occurred during "custom_attributes" processing. Attribute "kudos_colour" has invalid value. Invalid type for value: "Green". Expected Type: "int".

I don't understand why it is expecting an integer, all the values in the setup are strings.

1 Answer 1

0

I think I understand now. Instead of passing the actual value you need to pass in the value id which you can get from the catalogProductAttributeOptionManagementV1 service. Have tried this and now working.

Your Answer

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

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