REST API - Examples using the category resource

Introduction

In this article, you will find examples of the provided resource usage for different operations. For each analyzed scenario, we provide an example of the data that you are expected to provide to the API, as well as an example response. Please read the page covering the category API resource if you haven't yet, to get more information about the category resource and the data it provides.

Example 1 - Creating a category

This example adds a sub-category to category 3

POST /api/categories
{
  "name": "Test-category",
  "parentId": 3
}

Example 2 - Adding categories with attributes and additional fields

POST /api/categories
{
  "name": "Test-category",
  "parentId": 3,
  "metaDescription": "metaTest",
  "metaKeywords": "keywordTest",
  "cmsHeadline": "headlineTest",
  "cmsText": "cmsTextTest",
  "active": true,
  "noViewSelect": true,
  "attribute": {
    "1": "Attribute1",
    "2": "Attribute2"
  }
}

Example 3 - Create a category with translation

POST /api/categories
{
  "name": "Test-category",
  "parentId": 3,
  "attribute": {
    "1": "Attr1"
  },
  "translations": {
    "2": {
      "shopId": 2,
      "description": "Test category, english translation",
      "__attribute_attribute1": "Attr1 English"
    }
  }
}
Top