Create a request to get product listing page data
This topic shows you how to make a call to the Sitecore Discover Search and Recommendation API to get product listing page (PLP) data in the following scenario:
-
You want to show 24 results on a PLP (
n_item= 24). -
You want to make a call to get data for the first page of the PLP (
page_number=1). -
You want all facets.
-
The user must be able to sort products by customer ratings.
Use the API explorer to try out requests and see sample responses.
To create a request to get PLP data:
-
In the header, add cookies and, if required, authentication details.
-
In the request body, add page context and user context. For page context, include the page
uriand locale information (if applicable). For user context, include either theuuidor theuser_ID. -
Add widget information. Here, we want all widgets.
-
Add pagination information. Specify the number of items (
n_item) you want to see in one page of search results. Also, specify the page (page_number) you are making the call for. -
Add facet information to tell Discover how many facets you want. Here, we want all facets.
-
Add sort information to tell Discover how you want to sort. Here, we want the customer to sort products by ratings in descending order.
-
Request product content. Here, we want the entire product.
You can see the complete request with all objects put together and the corresponding response in the sample section.