0

Using the following command twice fails:

curl -X POST -H "Authorization: Bearer XXXXX" -H "Content-Type:     application/json" -H "Cache-Control: no-cache" -d '{
"category": {
    "includeInMenu": true, 
    "name": "AB", 
    "id": 0, 
    "isActive": true, 
    "parentId": 0
}
}' "http://localhost/rest/V1/categories"

Even though I tried changing the "name" field.

Any Idea?

1

Use body like this.

{
  "parent_id": 2,
  "name": "Category 1",
  "is_active": true,
  "include_in_menu": true,
  "custom_attributes": [
    {
      "attribute_code": "is_anchor",
      "value": "1"
    },
    {
      "attribute_code": "url_key",
      "value": "category-1"
    }  
 ]
}

Custom attributes "url_key" must be unique for all categories (and products)

  • Actually, the "parent_id": 2 was enough. Thanks! – Michael Mar 31 '16 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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