I am creating Product in magento usign Rest API. Using the below format:
{
"product": {
"name": "Product Name",
"sku": "product_name_1498227094",
"attribute_set_id": "18",
"status": 1,
"visibility": 4,
"type_id": "simple",
"price": 0,
"weight": 0,
"product_links": [],
"options": [],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "description",
"value": "Product About content"
},
{
"attribute_code": "short_description",
"value": "Product Mini content"
},
{
"attribute_code": "meta_title",
"value": "Product Name"
},
{
"attribute_code": "meta_keyword",
"value": "Product Name"
},
{
"attribute_code": "meta_description",
"value": "Product Name"
}
]
},
"saveOptions": true
}
Its creating Product first time. But If I use the same data to create product again. I am getting the below error:
[message] => URL key for specified store already exists.
As you can check, I am not passing url_key
in custom_attributes
array.
{
"attribute_code": "url_key",
"value": "10090-white-xl"
}
Here my question is: Do magento2 not create Unique URL key automatically? How can we generate Unique URL key in magento2 with consideration of SEO also ?