1
  1. I use Magento2.
  2. I have 2000 products.
  3. I try to get all products, using Rest API.

My request str.: GET https:///rest/default/V1/products?searchCriteria[pageSize]=1000. But this is not enough because the total quantity of products is 2000.

If I try to use:

  • GET https:///rest/default/V1/products?searchCriteria[pageSize]=0 or
  • GET https:///rest/default/V1/products?searchCriteria.

I received error or empty response. I think the response data is too large. So I think, that I need to use pages.

QUESTION: How can I create a Next page, that will start from the last data of the previous page? EXAMPLE:

  • I have 20 products;
  • 1-st Page includes 10 products (From 1 to 10);
  • 2-nd Page should include 11 products(From 10 to 20);

2 Answers 2

0

You need to pass the currentPage parameter in the rest API. Like this

/V1/products/?searchCriteria[currentPage]=1&searchCriteria[pageSize]=100

For detailed info about currentPage parameter check this link: https://devdocs.magento.com/guides/v2.4/graphql/queries/products.html#currentpage-attribute

0

You can add the limit and current page fields to get the desired quantity of products

V1/products?searchCriteria[filter_groups][1][filters][0][field]=limit&searchCriteria[filter_groups][1][filters][0][value]=20&searchCriteria[filter_groups][1][filters][0][condition_type]=eq&searchCriteria[filter_groups][2][filters][3][field]=cur&searchCriteria[filter_groups][2][filters][3][value]=1&searchCriteria[filter_groups][2][filters][3][condition_type]=eq

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.