Retrieving a specific page of the search results
When you make a request, there can be multiple pages of results for your query. This topic shows how you can retrieve different pages of the search results. This is a continuation of the Querying product content example.
In the following code, you request the next three products for page number two of the results:
RequestResponse
{
"query": {
"keyphrase": ["red"]
},
"n_item": 3,
"page_number": 2,
"content": {}
}The following code shows the corresponding response:
RequestResponse
{
"ts": 1480977544,
"rid": "response_id_q3",
"url": "/searchpage?keyphrase=red&page=2",
"query2id": {
"keyphrase": "keyphrase_id_red"
},
"content": {
"product": {
"value": [
{"name": "jacket", "color": "red", "price": 80},
{"name": "red dress", "price": 100}
]
}
},
"n_item": 2,
"total_item": 5,
"page_number": 2,
"total_page": 2
}Although three items per page (n_item = 3) are requested, you only get two product items in the response. This is because there are only five items in total and you are retrieving the last page, which returns only the two remaining items.