ProductViewHandler (Search)
This class provides RESTful services to get the ProductView details. It performs the services on the WebSphere Commerce Search server.
Instead of using the /wcs/resources/store/ URI, the Search 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 |
---|---|---|---|---|---|---|
findProductsBySearchTerm | GET | store/{storeId}/productview/bySearchTerm/{searchTerm} | searchSource={searchSource}& searchType={searchType}& intentSearchTerm={intentSearchTerm}& originalSearchTerm={originalSearchTerm}& categoryId={categoryId} facet={facet}*& facetLimit={facetLimit}*& advancedFacetList={advancedFacetList}& filterFacet={filterFacet}& filterTerm={filterTerm}& filterType={filterType}& manufacturer={manufacture}& minPrice={minPrice}& maxPrice={maxPrice}& physicalStoreId={physicalStoreId}*& pageSize={pageSize}& pageNumber={pageNumber}& orderBy={orderBy}& landingPage=true& searchTerm={searchTerm}& priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter}. | Gets product details based on a search term. | No,HTTP | Sample |
findProductById | GET | store/{storeId}/productview/byId/{productId} | priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter} | Gets product details based on the product ID. | No,HTTP | Sample |
findProductsByIds | GET | store/{storeId}/productview/byIds | id={productId}*& priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter} | Gets product details based on the product IDs. | No,HTTP | Sample |
findProductByPartNumber | GET | store/{storeId}/productview/{partNumber} | partNumber={partNumber}& priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter} | Gets products by part number. | No,HTTP | Sample |
findProductsByCategory | GET | store/{storeId}/productview/byCategory/{categoryId} | facet={facet}*& facetLimit={facetLimit}*& advancedFacetList={advancedFacetList}& filterFacet={filterFacet}& filterTerm={filterTerm}& filterType={filterType)& manufacturer={manufacturer}& minPrice={minPrice}& maxPrice={maxPrice}& pageNumber={pageNumber}& pageSize={pageSize}& orderBy={orderBy}& searchType={searchType}& searchSource={searchSource}& priceMode={priceMode}& checkEntitlement={checkEntitlement}& attachementFilter={attachementFilter} | Gets products by the parent category ID. This API will return all products under this category and does not return products under any subcategory by default. To enable deep search for searching products in all subcategories, the category being searched must be enabled using the Expanded category navigation store function in the Management Center. | No,HTTP | Sample |
Where the following Query Parameters are defined as:
- searchSource
- Mapped to _wcf.search.source.
- originalSearchTerm
- Mapped to _wcf.search.originalterm.
- intentSearchTerm
- Mapped to _wcf.search.intent.term.
- categoryId
- Mapped to _wcf.search.category. The category ID to use for the search.
- searchType
- Mapped to _wcf.search.type. It is a numeric string with 2 purposes:
- 1: Control which operator: ANY, OR, AND.
- 2: Control what data to be returned.
- physicalStoreIds
- The list of physical store location IDs obtained from the cookie container.
- facet
- Mapped to _wcf.search.facet. The multiple name-value pairs of facet names define what facets to be returned in the facet section.
- facetLimit
- The multiple name-value pairs of facet limits defining the maximum number of items to be returned under each facet.
- advancedFacetList
- Mapped to _wcf.search.advanced.facet.
- filterFacet
- Mapped to _wcf.search.exclude.facet. The facet name to be used for filtering the search results.
- filterTerm
- Mapped to _wcf.search.exclude.term. The string used to exclude the results containing this string.
- filterType
- Mapped to _wcf.search.exclude.type. It is used for the following
advanced search options:
- 0: Search for any match.
- 1: Search for exact match.
- 2: Search for all matches.
- manufacturer
- Mapped to _wcf.search.manufacturer. Returns items with this brand or manufacturer name.
- minPrice
- Mapped to _wcf.search.price.minimum. Returns items with this minimum price.
- maxPrice
- Mapped to _wcf.search.price.maximum. Returns items with this maximum price.
- 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.
- pageSize
- Mapped to _wcf.search.page.size. Returns up to the maximum number of items (immediate child categories) in the response.
- 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.
- id
- The repeated value list of product IDs. For example,
id=10001&id=10002
. - landingPage
- The landing page information will be returned if it is available and the value is true.
- searchTerm
- The optional searchTerm parameter that will replace the {searchTerm} value in the context path parameter. It is used to avoid potential limitations of the special characters that are part of the context path.
- partNumber
- The optional partNumber parameter that will replace the {partNumber} value in the context path parameter. It is used to avoid potential limitations of the special characters that are part of the context path.
- priceMode
- The price mode to be used to calculate the price when requesting the product information.
- checkEntitlement
- The boolean flag to indicate whether to check entitlement of the caller. To check entitlement, the flag must be set to true.
- attachmentFilter
- The filter string to include or exclude attachment details based on the usage of the attachment, with inclusion and exclusion being used for the filtering list.
Note: JSON is the only response format supported
by the WebSphere Commerce search ProductViewHandler 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.