cancel
Showing results for 
Search instead for 
Did you mean: 

Found duplicate products in the REST API with pagination

Found duplicate products in the REST API with pagination

Preconditions and environment

  • Magento version: 2.4.6-p4

Steps to reproduce

  1. Create a product attribute: attribute label "Is Featured", attribute code "is_featured" and type is Yes/No and sortable.
  2. Go to Attribute Sets and assign the "Is Featured" product attribute to the "Bag" attribute set.
  3. Open the product. SKU: 24-MB03
  4. Enable the "Is Featured" product attribute and save it.
  5. In the product search criteria, use the API method "GET" and add this URL, and run it for page 1. 
    https://example.com/rest/V1/products?searchCriteria[currentPage]=1&searchCriteria[pageSize]=9&search...
  6. In the product search criteria, use the API method "GET" and add this URL, and run it for page 4. (In other pages as well)
    https://example.com/rest/V1/products?searchCriteria[currentPage]=4&searchCriteria[pageSize]=9&search...


Expected result

In the API response output, if I set the sort order of the boolean product attribute, it should show unique products on every page.

Actual result

-> On page number one: ID 3 which we have enabled the "is_featured" product attribute So It's coming first.
{ "items": [ { "id": 3 }, { "id": 1 }, { "id": 2 }, { "id": 4 }, { "id": 5 }, { "id": 6 }, { "id": 7 }, { "id": 8 }, { "id": 9 } ] }


-> On page number four: I have found the duplicates products
{ "items": [ { "id": 9 }, { "id": 8 }, { "id": 7 }, { "id": 6 }, { "id": 5 }, { "id": 4 }, { "id": 2 } ] }