Feature request from careys7, posted on GitHub Jan 10, 2017
Preconditions
- Magento 2.0.0 - 2.1.3 (Community or Enterprise) with Sample Data installed
- Environment using magento2-docker-compose
Steps to reproduce
This issue appears to affect at least /products/ and /categories/ requests. I have added below an example for products.
- Make API request for products specifying page size as 1, current page as 99999, eg:
GET /rest/default/V1/products/?searchCriteria[pageSize]=1&searchCriteria[currentPage]=9999
HTTP/1.1
Host: m2.localhost:8000
Authorization: OAuth oauth_consumer_key="sitoq7tu4b1aj7kikj4irkog8tggh1ch",oauth_token="kr3bly2kbbnrr9flyws9r4mxdaagxngo",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1484095699",oauth_nonce="TivkWr",oauth_version="1.0",oauth_signature="Q02C2wk4AgkDPkYAbACUoLMoXa4%3D"
Cache-Control: no-cache
Note: Page size of '1' above is a nominal value to make examples given below more concise.
Expected result
- No items returned in response if (current page * page size) > total products, eg:
{
"items": [],
"search_criteria": {
"filter_groups": [],
"page_size": 1,
"current_page": 99999
},
"total_count": 2048
}
Actual result
- The product with highest id is returned, eg:
{
"items": [
{
"id": 2048,
"sku": "24-WG085_Group",
"name": "Set of Sprite Yoga Straps",
"attribute_set_id": 12,
"status": 1,
"visibility": 4,
"type_id": "grouped",
"created_at": "2016-11-13 21:24:31",
"updated_at": "2016-11-13 21:24:31",
"extension_attributes": [],
"product_links": [
{
"sku": "24-WG085_Group",
"link_type": "associated",
"linked_product_sku": "24-WG085",
"linked_product_type": "simple",
"position": 0,
"extension_attributes": {
"qty": 0
}
},
{
"sku": "24-WG085_Group",
"link_type": "associated",
"linked_product_sku": "24-WG086",
"linked_product_type": "simple",
"position": 1,
"extension_attributes": {
"qty": 0
}
},
{
"sku": "24-WG085_Group",
"link_type": "associated",
"linked_product_sku": "24-WG087",
"linked_product_type": "simple",
"position": 2,
"extension_attributes": {
"qty": 0
}
}
],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "description",
"value": "<p>Great set of Sprite Yoga Straps for every stretch and hold you need. There are three straps in this set: 6', 8' and 10'.</p>\n<ul>\n<li> 100% soft and durable cotton.\n<li> Plastic cinch buckle is easy to use.\n<li> Choice of three natural colors made from phthalate and heavy metal free dyes.\n</ul>"
},
{
"attribute_code": "image",
"value": "/l/u/luma-yoga-strap-set.jpg"
},
{
"attribute_code": "small_image",
"value": "/l/u/luma-yoga-strap-set.jpg"
},
{
"attribute_code": "thumbnail",
"value": "/l/u/luma-yoga-strap-set.jpg"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "url_key",
"value": "set-of-sprite-yoga-straps"
},
{
"attribute_code": "is_returnable",
"value": "2"
},
{
"attribute_code": "activity",
"value": "17"
},
{
"attribute_code": "material",
"value": "41,53"
},
{
"attribute_code": "gender",
"value": "89,90,93"
},
{
"attribute_code": "category_gear",
"value": "96"
},
{
"attribute_code": "size",
"value": "100"
}
]
}
],
"search_criteria": {
"filter_groups": [],
"page_size": 1,
"current_page": 99999
},
"total_count": 2048
}