Examples
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.
Category | Sub-Categories | Products |
---|---|---|
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.
- Create the
style
attribute with the valuesmodern
,traditional
, andrustic
using theproduct-attributes
endpoint. This attribute distinguishes lamps by aesthetic, and is defined with theOPTIONS
type to support multiple accepted values. IfisMandatory
is set totrue
, 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
- Create the
lamps
category using thecategories
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
- Create the
ceiling lamps
andtable lamps
subcategories using the bulk insert API. In the request body, provide theparentCategoryId
from thelamps
category created in Step 2. You can optionally enable localization support using theisLocalizable
field and define localized names underlocalizedProperties
.
Bash
- Map the
style
attribute to thelamps
category using thecategories
endpoint. SetisMandatory
totrue
to ensure that all products in this category and its subcategoriesceiling lamps
andtable lamps
must include astyle
value. This attribute mapping ensures consistency across the product hierarchy and streamlines catalog validation. Use the attribute ID returned when thestyle
attribute was created.
Bash
- Create four
live
status products, each assigned to either theceiling lamps
ortable lamps
subcategory. To enable variants, include theparentProduct
field for each variant entry. Use the bulk insert API to add the base products along with their attributes, such asstyle
,name
,SKU
, and image URL. Variants will inherit the category and must meet any mandatory attribute requirements defined earlier.
Bash
- Create a
sale
category forModern Style Furniture
andCyber Monday
- Create the parent collection,
sale
.
Bash
- Create the sub category
Current Sales
. TheparentCollectionID
is returned from the previous response when creating the parent collectionsale
.
Bash
- Create the
Modern Style Furniture
andCyber Monday
categories.
Bash
- Optionally, you can include products in a sale tab by filtering for specific attributes using
productAttributeFilters
.
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.