Create category service

POST /V1/categories

Create category service

Body

  • category object Required

    Category data interface.

    Hide category attributes Show category attributes object
    • id integer

      Category id.

    • parent_id integer

      Parent category ID

    • name string

      Category name

    • is_active boolean

      Whether category is active

    • position integer

      Category position

    • level integer

      Category level

    • children string

      Children ids comma separated.

    • created_at string

      Category creation date and time.

    • updated_at string

      Category last update date and time.

    • path string

      Category full path.

    • available_sort_by array[string]

      Available sort by for category.

    • include_in_menu boolean

      Category is included in menu.

    • extension_attributes object

      ExtensionInterface class for @see \Magento\Catalog\Api\Data\CategoryInterface

    • custom_attributes array[object]

      Interface for custom attribute value.

      Interface for custom attribute value.

      Hide custom_attributes attributes Show custom_attributes attributes object
      • attribute_code string Required

        Attribute code

      • value string Required

        Attribute value

Responses

  • 200

    200 Success.

    Hide response attributes Show response attributes object
    • id integer

      Category id.

    • parent_id integer

      Parent category ID

    • name string

      Category name

    • is_active boolean

      Whether category is active

    • position integer

      Category position

    • level integer

      Category level

    • children string

      Children ids comma separated.

    • created_at string

      Category creation date and time.

    • updated_at string

      Category last update date and time.

    • path string

      Category full path.

    • available_sort_by array[string]

      Available sort by for category.

    • include_in_menu boolean

      Category is included in menu.

    • extension_attributes object

      ExtensionInterface class for @see \Magento\Catalog\Api\Data\CategoryInterface

    • custom_attributes array[object]

      Interface for custom attribute value.

      Interface for custom attribute value.

      Hide custom_attributes attributes Show custom_attributes attributes object
      • attribute_code string Required

        Attribute code

      • value string Required

        Attribute value

  • 401

    401 Unauthorized

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Error details

      Hide errors attributes Show errors attributes object
      • message string

        Error message

      • parameters array[object]

        Error parameters item

        Error parameters item

        Hide parameters attributes Show parameters attributes object
        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Error parameters item

      Hide parameters attributes Show parameters attributes object
      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

  • 400

    400 Bad Request

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Error details

      Hide errors attributes Show errors attributes object
      • message string

        Error message

      • parameters array[object]

        Error parameters item

        Error parameters item

        Hide parameters attributes Show parameters attributes object
        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Error parameters item

      Hide parameters attributes Show parameters attributes object
      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

  • default

    Unexpected error

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Error details

      Hide errors attributes Show errors attributes object
      • message string

        Error message

      • parameters array[object]

        Error parameters item

        Error parameters item

        Hide parameters attributes Show parameters attributes object
        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Error parameters item

      Hide parameters attributes Show parameters attributes object
      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

POST /V1/categories
curl \
 --request POST 'https://magento2.winkelstraat.mac/rest/all/V1/categories' \
 --data '{"category":{"id":42,"parent_id":42,"name":"string","is_active":true,"position":42,"level":42,"children":"string","created_at":"string","updated_at":"string","path":"string","available_sort_by":["string"],"include_in_menu":true,"extension_attributes":{},"custom_attributes":[{"attribute_code":"string","value":"string"}]}}'
Request examples
{
  "category": {
    "id": 42,
    "parent_id": 42,
    "name": "string",
    "is_active": true,
    "position": 42,
    "level": 42,
    "children": "string",
    "created_at": "string",
    "updated_at": "string",
    "path": "string",
    "available_sort_by": [
      "string"
    ],
    "include_in_menu": true,
    "extension_attributes": {},
    "custom_attributes": [
      {
        "attribute_code": "string",
        "value": "string"
      }
    ]
  }
}
Response examples (200)
{
  "id": 42,
  "parent_id": 42,
  "name": "string",
  "is_active": true,
  "position": 42,
  "level": 42,
  "children": "string",
  "created_at": "string",
  "updated_at": "string",
  "path": "string",
  "available_sort_by": [
    "string"
  ],
  "include_in_menu": true,
  "extension_attributes": {},
  "custom_attributes": [
    {
      "attribute_code": "string",
      "value": "string"
    }
  ]
}
Response examples (401)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}
Response examples (400)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}
Response examples (default)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}