Feature Pack 7

SiteContentHandler (Search)

This class provides RESTful services to get resource details for site content. It performs the services on the WebSphere Commerce search 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.

Feature Pack 7 or later

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
findWebContentsBySearchTerm GET store/{storeId}/sitecontent/webContentsBySearchTerm/{searchTerm} orderBy={orderBy}& pageNumber={pageNumber}& pageSize={pageSize}& searchTerm={searchTerm} Search unstructured content details for search result page based on a search term. No,HTTP Sample
findKeywordSuggestionsByTerm GET store/{storeId}/sitecontent/keywordSuggestionsByTerm/{term} count={count}& sort={termsSort}& searchTerm={searchTerm} Auto-suggest terms with type ahead search. No,HTTP Sample
findAllCategorySuggestions GET store/{storeId}/sitecontent/categorySuggestions WebSphere Commerce search query parameters&catalogId={catalogId} Gets all the category suggestions for auto-suggest with type ahead search No,HTTP Sample
findAllBrandSuggestions GET store/{storeId}/sitecontent/brandSuggestions WebSphere Commerce search query parameters&catalogId={catalogId} Gets all the brand suggestions for auto-suggest with typeahead search. No,HTTP Sample
findAllWebContentSuggestions GET store/{storeId}/sitecontent/webContentSuggestions WebSphere Commerce search query parameters&catalogId={catalogId} Gets all the unstructured content suggestions for auto-suggest with typeahead search. No,HTTP Sample
findSuggestions GET /search/resources/store/{storeid}/sitecontent/suggestions WebSphere Commerce search query parameters&catalogId={catalogId} Merges the following services:
  • categorySuggestions
  • brandSuggestions
  • webContentSuggestions
No,HTTP
Where the following Query Parameters are defined as:
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.
These values are configurable in the WebSphere Commerce search configuration file. For more information, see WebSphere Commerce search configuration file (wc-search.xml) (Search EAR).
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.
This parameter is used with the pageSize parameter.
The default value is 1.
pageSize
Mapped to _wcf.search.page.size. Returns up to the maximum number of items (immediate child categories) in the response.
All items will be returned if this parameter is not specified.
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.
limit
The number of suggested keywords to be returned.
The default value is 4.
sort
The sorting to be used in the returned result, either count or index.
The default value is count.
Note:
  • JSON is the only response format supported by the WebSphere Commerce search SiteContentHandler by default.
  • The following methods do not support the catalogId query parameter:
    • findWebContentsBySearchTerm
    • findKeywordSuggestionsByTerm
    • findAllWebContentSuggestions
  • Feature Pack 8The findKeywordSuggestionsByTerm method supports the catalogId query parameter in Feature Pack 8.
Feature Pack 7 or later

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.
For example, for a service with the following URI:

<GetUri uri="store/{storeId}/categoryview/byId/{categoryId}"
description="Get category by unique ID"
searchProfile="IBM_findCategoryByUniqueIds,IBM_Admin_findCategoryByIds"/>
The IBM_Admin_findCategoryByIds search profile can be specified, while IBM_findCategoryByUniqueIds is the default search profile when the profileName is not specified.
responseTemplate
The structure of response that is being used.
A value of 0 generates BOD-like responses for the responsive Aurora starter store, while a value of 1 generates REST responses.
The default value is 0.
Field name mapping definitions are used to leverage different fields in responses. The mappings are divided into the following categories:
CatalogEntryView
Maps the catalog entry section inside the Product REST responses.
CatalogGroupView
Maps the category section inside the Category REST responses.
WebContentView
Maps the web content section inside the SiteContent REST responses.
The mappings are stored in the Search_eardir/xml/config/com.ibm.commerce.catalog/wc-component.xml file.