This page walks through an example setup for a merchant selling furniture—specifically, how a store might structure its Product Catalog to support a category for lamps. The example includes creating attributes, categories, subcategories, and products such as ceiling and table lamps. The table below shows the structure being created.

CategorySub-CategoriesProducts
Lamps
Ceiling Lamps
Atlas Pendant Ceiling Lamp
Apollo Pendant Ceiling Lamp
Table Lamps
Hudson Table Lamp
Luminary Table Lamp

Both items and categories have attributes. Each product can have multiple attributes associated with it. Because you need to add attributes to both categories and products, the first step in building the lamps category is to create the necessary attributes. In this example, lamps need to have a style attribute for all the products.

  1. Create the style attribute with the values modern, traditional, and rustic using the product-attributes endpoint. This attribute distinguishes lamps by aesthetic, and is defined with the OPTIONS type to support multiple accepted values. If isMandatory is set to true, any product associated with the attribute must include one of the accepted values. The request returns a unique attribute ID, which you’ll need when mapping attributes later in the process.

Bash

curl --location 'https://api.fabric.inc/v3/product-attributes' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-fabric-tenant-id: ' \
--header 'Authorization;' \
--data '
{
  "name": "Style",
  "type": "OPTIONS",
  "target": "PRODUCT",
  "isLocalizable":false,
  "localizedProperties":{},
  "validation": {
    "isMandatory": false,
    "acceptedValues": ["Modern", "Traditional", "Rustic"],
    "subType": "SINGLE",
    "isManualOverwrite": false,
    "isDecimal": false,
    "formula": ""
  }
}
'
  1. Create the lamps category using the categories endpoint. This serves as the top-level group for all lamp-related products. After a successful request, the response will return a category ID—keep this ID on hand, as you’ll use it when creating sub-categories in the next step.

Bash

--location 'https://api.fabric.inc/v3/categories' \
--header 'x-fabric-tenant-id: ' \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--data '{
  "name":"Lamps"
}
'
  1. Create the ceiling lamps and table lamps subcategories using the bulk insert API. In the request body, provide the parentCategoryId from the lamps category created in Step 2. You can optionally enable localization support using the isLocalizable field and define localized names under localizedProperties.

Bash

curl --location 'https://api.fabric.inc/v3/categories/batch' \
--header 'x-fabric-tenant-id: ' \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--data '{
    "categories": [
        {
            "parentCategoryId": "65a503418b49c6d313211159",
            "name": "Ceiling Lamps",
            "isLocalizable": true,
            "localizedProperties": {
              "en-US": {
                "name": "Ceiling Lamps"
              },
              "es-US": {
                "name": "Lámparas de techo"
              }
            },  
         },
         {
            "parentCategoryId": "65a503418b49c6d313211159",
            "name": "Table Lamps",
            "isLocalizable": true,
            "localizedProperties": {
              "en-US": {
                "name": "Table Lamps"
              },
              "es-US": {
                "name": "Lámparas de mesa"
              }
            }, 
         }
        }
    ],
}'
  1. Map the style attribute to the lamps category using the categories endpoint. Set isMandatory to true to ensure that all products in this category and its subcategories ceiling lamps and table lamps must include a style value. This attribute mapping ensures consistency across the product hierarchy and streamlines catalog validation. Use the attribute ID returned when the style attribute was created.

Bash

curl --location --request PUT 'https://api.fabric.inc/v3/categories/557f1f77bcf86cd799439015' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-fabric-tenant-id: ' \
--header 'Authorization: ' \
--data '
{ "name": "Lamps",
  "productAttributes": [
    {
      "isMandatory": true,
      "id": "557f1f77bcf86cd799439015"
    }
  ]
}
'
  1. Create four live status products, each assigned to either the ceiling lamps or table lamps subcategory. To enable variants, include the parentProduct field for each variant entry. Use the bulk insert API to add the base products along with their attributes, such as style, name, SKU, and image URL. Variants will inherit the category and must meet any mandatory attribute requirements defined earlier.

Bash

curl --location 'https://api.fabric.inc/v3/product-catalog/batch' \
--header 'x-fabric-tenant-id: ' \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--data '{
    "products": [
        {
            "sku": "AGLAMPTL12",
            "status":"LIVE",
            "categoryId": "65a505cf8b49c6d313211187",
            "isActive": true,
            "type": "ITEM",
            "attributes": [
                {
                    "id": "65a503bfd97969bcbb224415",
                    "value": ["modern"]
                },
                   {
                    "id": "6464ecfc4529ad33084c4adb",
                    "value": "Hudson Table Lamp"
                },
                {
                  "id" : "6464ecfc4529ad33084c4ad7",
                  "value": "AGLAMPTL12"
                },
                {
                    "id": "6464ecfc4529ad33084c4acb",
                    "value" : "https://exampleimagelink.me/assets/images/exampleimagelink.png"
                },
                 {
                    "id": "6464ecfd4529ad33084c4adf",
                    "value" : "FALSE"
                }
            ]
        },
          {
            "sku": "AGLAMPTL9",
            "status":"LIVE",
            "categoryId": "65a505cf8b49c6d313211187",
            "isActive": true,
            "type": "ITEM",
            "attributes": [
                {
                    "id": "65a503bfd97969bcbb224415",
                    "value": ["rustic"]
                },
                   {
                    "id": "6464ecfc4529ad33084c4adb",
                    "value": "Luminary Table Lamp"

                },
                  {
                  "id" : "6464ecfc4529ad33084c4ad7",
                  "value": "AGLAMPTL9"
                },
                {
                    "id": "6464ecfc4529ad33084c4acb",
                    "value" : "https://exampleimagelink.me/assets/images/exampleimagelink.png"
                },
                 {
                    "id": "6464ecfd4529ad33084c4adf",
                    "value" : "FALSE"
                }
            ]
        },
        {
            "sku": "AGLAMPCL2",
            "status":"LIVE",
            "categoryId": "65a505cf8b49c6d313211187",
            "isActive": true,
            "type": "ITEM",
            "attributes": [
                {
                    "id": "65a503bfd97969bcbb224415",
                    "value": ["rustic"]
                },
                {
                    "id": "6464ecfc4529ad33084c4adb",
                    "value": "Apollo Pendant Ceiling Lamp"

                },
                  {
                  "id" : "6464ecfc4529ad33084c4ad7",
                  "value": "AGLAMPCL2"
                },
                {
                    "id": "6464ecfc4529ad33084c4acb",
                    "value" : "https://exampleimagelink.me/assets/images/exampleimagelink.png"
                },
                 {
                    "id": "6464ecfd4529ad33084c4adf",
                    "value" : "FALSE"
                }
            ]
        },
        {
            "sku": "AGLAMPCL5",
            "status":"Live",
            "categoryId": "65a505cf8b49c6d313211187",
            "isActive": true,
            "type": "ITEM",
            "attributes": [
                {
                    "id": "65a503bfd97969bcbb224415",
                    "value": ["modern"]
                },
                {
                    "id": "6464ecfc4529ad33084c4adb",
                    "value": "Atlas Pendant Ceiling Lamp"

                },
                  {
                  "id" : "6464ecfc4529ad33084c4ad7",
                  "value": "AGLAMPCL5"
                },
                {
                    "id": "6464ecfc4529ad33084c4acb",
                    "value" : "https://exampleimagelink.me/assets/images/exampleimagelink.png"
                },
                 {
                    "id": "6464ecfd4529ad33084c4adf",
                    "value" : "FALSE"
                }
            ]
        },
        {
            "parentProduct": {
                "sku": "AGLAMPCL5"
            },
            "sku": "GLAMPCL5",
            "status": "LIVE",
            "categoryId": "65a505cf8b49c6d313211187",
            "isActive": false,
            "type": "VARIANT",
            "attributes": [
                {
                    "id": "65a503bfd97969bcbb224415",
                    "value": ["modern"]
                },
                  {
                    "id": "6464ecfc4529ad33084c4adb",
                    "value": "Green"

                },
                  {
                  "id" : "6464ecfc4529ad33084c4ad7",
                  "value": "GLAMPCL5"
                },
                 {
                    "id": "6464ecfc4529ad33084c4acb",
                    "value" : "https://exampleimagelink.me/assets/images/exampleimagelink.png"
                },
                 {
                    "id": "6464ecfd4529ad33084c4adf",
                    "value" : "FALSE"
                }
            ]
        },
           {
            "parentProduct": {
                "sku": "AGLAMPCL5"
            },
            "sku": "AGLAMPCL1",
            "status": "LIVE",
            "categoryId": "65a505cf8b49c6d313211187",
            "isActive": false,
            "type": "VARIANT",
            "attributes": [
                {
                    "id": "65a503bfd97969bcbb224415",
                    "value": ["modern"]
                },
                  {
                    "id": "6464ecfc4529ad33084c4adb",
                    "value": "Gold"

                },
                  {
                  "id" : "6464ecfc4529ad33084c4ad7",
                  "value": "AGLAMPCL1"
                },
                 {
                    "id": "6464ecfc4529ad33084c4acb",
                    "value" : "https://exampleimagelink.me/assets/images/exampleimagelink.png"
                },
                 {
                    "id": "6464ecfd4529ad33084c4adf",
                    "value" : "FALSE"
                }
            ]
        }
    ]
}'
  1. Create a sale category for Modern Style Furniture and Cyber Monday
  • Create the parent collection, sale.

Bash

curl --location 'https://api.fabric.inc/v3/collections' \
--header 'x-fabric-tenant-id: ' \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--data '{
    "isRoot": true,
    "isLocalizable": false,
    "name": "Sale",
    
}'
  • Create the sub category Current Sales. The parentCollectionID is returned from the previous response when creating the parent collection sale.

Bash

curl --location 'https://api.fabric.inc/v3/collections/batch' \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: ' \
--data '{
  "collections": [
    {
      "parentCollectionId": "65a5847b8b49c6d313211476",
      "name": "Current Sales",
      "isLocalizable": false,
      "isRoot": false,
      "isLeaf": false
    }
  ]
}'
  • Create the Modern Style Furniture and Cyber Monday categories.

Bash

curl --location 'https://api.fabric.inc/v3/collections/batch' \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: ' \
--data '{
  "collections": [
    {
      "parentCollectionId": "65a58a5b8b49c6d313211486",
      "name": "Modern Style Furniture",
      "isLocalizable": false,
      "isRoot": false,
      "isLeaf": false,
       "categoryIdsIncluded": [
        "65a503418b49c6d313211159"
      ]
    },

       {
      "parentCollectionId": "65a58a5b8b49c6d313211486",
      "name": "Cyber Monday",
      "isLocalizable": false,
      "isRoot": false,
      "isLeaf": false,
       "categoryIdsIncluded": [
        "65a503418b49c6d313211159"
      ]
    }
  ]
}'
  • Optionally, you can include products in a sale tab by filtering for specific attributes using productAttributeFilters.
"productAttributeFilters": [
        {
          "attributeId": "78184766610c0e32a86d8757",
          "condition": "EQUALS",
          "value": 2
        }
]

Error Handling

For effective error handling, refer to the API documentation which outlines standard HTTP error codes, such as 400 (Bad Request), 404 (Not Found), and 500 (Internal Server Error).

Next Steps

Once the above steps are completed, you are all set with the basic setup. You may proceed to fully utilize all features and capabilities available to you. Refer to the Related Resources for additional information.