cancel
Showing results for 
Search instead for 
Did you mean: 

REST API Adding Options to Configurable Product

REST API Adding Options to Configurable Product

I'm able to semi-successfully add options to a configurable product using REST API configurableProductOptionRepositoryV1 (/V1/configurable-products/{sku}/options). When the first option gets added, I get a "200 OK" response.  However when the second option gets added, I get a "400 Bad Request" even though the option gets added to the configurable product.  The JSON that i'm passing in the API call is the following:

 

'{
 "option": {
  "attributeId": "size",
  "label": "Size",
  "position": 0,
  "isUseDefault": false,
  "values": [
   {
    "valueIndex": #variables.size#
   }
  ]
 }
}'

 

I'm not quite sure what the use is for attributes "position" and "isUseDefault".  If anyone could shed light on either of those then that would be great. 

 

Any suggestions as to why adding the first option returns 200 while adding the subsequent options return 400?

 

Thanks for your help.

 

Keith

1 REPLY 1

Re: REST API Adding Options to Configurable Product

Hi Keith,

 

I'm also spending my time learning to add options to a configurable product using REST API.  I think the attribute "position" is for the display order of the option.  The "isUseDefault" could be just what it sounds like.  

 

I'm trying to create configurable products from scratch using the REST API.  Have you done it successfully?  I can add the configurable  base-product, without options, then add an option using the method you described.  However, I don't see any changes in the catalog or product administration page.

 

Did you get any further or solve this?

 

Thanks!

Greg