Loading...
Area: Optimizely B2B Commerce

Categories API handler

Recommended reading 

HTTP Verb: GET

URL: /api/v1/categories

Description: Return a collection of hierarchical categories

Base: HandlerBase<GetActiveCategoryLinksParameter, GetActiveCategoryLinksResult>

Handlers:

Order Handler

Description

500 GetActiveCategoryLinksHandler

Gets active categories. If StartCategoryId parameter is specified then handler returns only children of this category.

HTTP Verb: GET

URL: /api/v1/categories

Description: Return a collection of hierarchical categories.

Base: HandlerBase<GetCategoryCollectionParameter, GetCategoryCollectionResult>

Handlers:

Order Handler Description
500 GetMaxDepth Populates the max depth to search for categories. The MaxDepthproperty on the parameter object is used if it has a value, otherwise the Catalog "Category Menu Depth" setting is used. When the setting is used, the depth is limited to 3. The max depth is stored in the MaxDepthproperty on the result object.
600 GetStartCategory Retrieves the category from where the category tree will begin. If the StartCategoryIdproperty on the parameter object has no value, this handler is skipped. The category is stored in the StartCategoryproperty on the result object.
700 GetBaseLink Sets result BaseLink to blank if the start category is null, otherwise to the url of the start category.
800 GetCategories If the StartCategory property on the parameter object is not null, the application retrieves the active base categories (root categories). Otherwise, the application retrieves the subcategories for the category stored in the StartCategoryproperty. The result is stored in the Categoriesproperty on the result object.
900 CreateCategoryNavLinks Transforms the category tree into a collection of NavLinkDtoobjects that contain information like the URL path, name, and subcategories. The StartCategorycategory is not included in the category tree.

HTTP Verb: GET

URL: /api/v1/categories/{categoryId}

Description: Return a single category

Base: HandlerBase<GetCategoryParameter, GetCategoryResult>

Handlers:

Order Handler Description
500 GetCategoryHandler Gets category by id. If category not found then handler returns error result.
Order Handler Description
500 GetCategory Retrieves a category using the CategoryId property on the parameter object. If a category is not found or the category is not assigned to the current website, an error is returned. The category is stored in the Category property on the result object.
600 CopyCustomPropertiesToResult Copies custom properties configured for the category entity to the Properties property on the result object.
Do you find this information helpful? Please log in to provide feedback.

Last updated: Dec 11, 2020

Recommended reading