Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Categories API handler

Return a collection of hierarchical categories

HTTP Verb – GET

URL – /api/v1/categories

Description – Return a collection of hierarchical categories

Base – HandlerBase<GetActiveCategoryLinksParameter, GetActiveCategoryLinksResult>

Handlers

OrderHandlerDescription
500GetActiveCategoryLinksHandlerGets 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

OrderHandlerDescription
500GetMaxDepthPopulates 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.
600GetStartCategoryRetrieves 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.
700GetBaseLinkSets result BaseLink to blank if the start category is null, otherwise to the url of the start category.
800GetCategoriesIf 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.
900CreateCategoryNavLinksTransforms 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

OrderHandlerDescription
500GetCategoryHandlerGets category by id. If category not found then handler returns error result.
OrderHandlerDescription
500GetCategoryRetrieves 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.
600CopyCustomPropertiesToResultCopies custom properties configured for the category entity to the Properties property on the result object.