CategoryViewHandler (Search)
This class provides RESTful services to get category data for search-based catalog navigation. It performs the services on the WebSphere Commerce server.
Instead of using the /wcs/resources/store/ URI, the REST service URI must contain /search/resources/store/ under the default configuration.The supported search profiles are identified at runtime according to the Search-REST/WEB-INF/config/com.ibm.commerce.rest/wc-rest-resourceconfig.xml file. For more information about the WebSphere Commerce search profiles, see WebSphere Commerce search profiles.
WebSphere Commerce search REST APIs
The REST classes that are denoted by (Search) in the title are applicable to the WebSphere Commerce search server.
They
have the following benefits over the BOD-based REST services:
- The services are served by the search server and can be separately scaled from the WebSphere Commerce server. Instead, the WebSphere Commerce server is used for processing transactional requests.
- The WebSphere Commerce search REST API is built to extract data from Solr queries, avoiding the need for the BOD mediation layer.
Note: Attributes that are not managed by the Attribute Dictionary
are not indexed or returned by default in search-based REST responses.
You must either migrate your attributes to the Attribute Dictionary,
or create a custom postprocessor to fetch the applicable attributes
to catalog entries in the response, and then add them to the search-based
REST response.
Method Name | HTTP Method | URL | Query Parameters | Description | Authentication | Example |
---|---|---|---|---|---|---|
findCategoryByUniqueId | GET | store/{storeId}/categoryview/byId/{categoryId} | checkEntitlement={checkEntitlement} | Gets category details based on its unique ID. | No,HTTP | Sample |
findCategoryByUniqueIds | GET | store/{storeId}/categoryview/byIds | orderBy={orderBy}& id={categoryId}*& checkEntitlement={checkEntitlement} | Gets category details based on its unique ID. | No,HTTP | Sample |
findCategoryByIdentifier | GET | store/{storeId}/categoryview/{categoryIdentifier} | categoryIdentifier={categoryIdentifier} | Gets category details based on its identifier. | No,HTTP | Sample |
findTopCategories | GET | store/{storeId}/categoryview/@top?catalogId={catalogId} | depthAndLimit={listOfLimits}& pageNumber={pageNumber}& pageSize={pageSize}& orderBy={orderBy}& checkEntitlement={checkEntitlement} | Gets all the top level categories and optionally subcategories. | No,HTTP | Sample |
findSubCategories | GET | store/{storeId}/categoryview/byParentCategory/{parentCategoryId}?catalogId={catalogId} | depthAndLimit={listOfLimits}& pageNumber={pageNumber}& pageSize={pageSize}& orderBy={orderBy}& checkEntitlement={checkEntitlement} | Gets child categories based on the parent category unique ID. | No,HTTP | Sample |
Where the following Query Parameters are defined as:
- id
- The repeated value list of category IDs. For example,
id=123&id=456
. - pageSize
- Mapped to _wcf.search.page.size. Returns up to the maximum number of items (immediate child categories) in the response.
- pageNumber
- Mapped to _wcf.search.page.number. Returns results of the page number, starting from 1, if there are more results than the pageSize number.
- depthAndLimit {listOfLimits}
- Mapped to _wcf.search.category.limitSubCategories. The comma separated
list of numbers is to control the depth of subcategories and limit
the number of items returned under each child category level. The
first number in this list determines the maximum of categories (first-level
subcategories) to be returned under the immediate child category.
The second number in the list determines the maximum number of categories
to be returned under the first-level subcategories. A value of
-1
implies no limit, where only the first-level categories will be returned. - orderBy
- Mapped to _wcs.search.sort:
- 1: Sort by brand/manufacturer name in ascending alphabetical order.
- 2: Sort by category name in ascending alphabetical order.
- 3: Sort by price in ascending order.
- 4: Sort by price in descending order.
- categoryIdentifier
- The optional categoryIdentifier parameter that will replace the {categoryIdentifier} value in the context path parameter. It is used to avoid potential limitations of the special characters that are part of the context path.
- checkEntitlement
- The boolean flag to indicate whether to check entitlement of the caller. To check entitlement, the flag must be set to true.
Note: JSON is the only response format supported
by the WebSphere Commerce search CategoryViewHandler by default.
WebSphere Commerce search query parameters
The following query parameters
are specific to the WebSphere Commerce search REST API, such as the
CategoryViewHandler, ProductViewHandler, and SiteContentHandler resources.
- profileName
- An optional search profile name that can be specified. It must be listed under the Search-Rest/WEB-INF/config/com.ibm.commerce.rest/wc-rest-resourceconfig.xml configuration file for the resource that is being requested.
- responseTemplate
- The structure of response that is being used.