I am calling this API to get product details:
GET https://domain.com/index.php/rest/V1/products/:SKU
and get this response:
<id>678</id>
<sku>Mysku</sku>
<name>myName</name>
<attribute_set_id>4</attribute_set_id>
<price>0</price>
<status>1</status>
<visibility>4</visibility>
<type_id>configurable</type_id>
<created_at>2017-04-23 15:01:05</created_at>
<updated_at>2017-04-30 17:57:28</updated_at>
<weight>0.1</weight>
<extension_attributes>
<configurable_product_options>
<item>
<id>38</id>
<attribute_id>93</attribute_id>
<label>Color</label>
<position>0</position>
<values>
<item>
<value_index>56</value_index>
</item>
<item>
<value_index>61</value_index>
</item>
<item>
<value_index>62</value_index>
</item>
</values>
<product_id>678</product_id>
</item>
</configurable_product_options>
<configurable_product_links>
<item>675</item>
<item>676</item>
<item>677</item>
</configurable_product_links>
</extension_attributes>
....
I have a color in response. How can I add color option to cart. I tried with:
POST https://domain/rest/V1/guest-carts/3f9a39f1524fb936d932b7e80a3e8cc1/items
Params: {
"cartItem" :
{
"sku" : "Mysku",
"qty" : 1,
"quoteId" : "3f9a39f1524fb936d932b7e80a3e8cc1",
"productOption":{
"extensionAttributes":{
"customOptions":[
{
"optionId":"38",
"optionValue":"56"
}
]
}
}
}
}
And get this error:
message "You need to choose options for your item."
I think I have something wrong in parameters. can any one help ?