Magento – How to get same products from rest api as are visible on frontend

magento-2.0magento-2.1magento2multistorerest

We would like to use REST API for mobile application where should be the same products as we have on frontend.

There are this conditions (params)

  • website ID (or store ID) we have multisite
  • show configurable products which are active and which have min one simple product which is active and which is sellable (qty > 0 or backorders are allowed)
  • Show simple which are visible individually and which are sellable (qty > 0 or backorders are allowed)
  • category ID

Is it possible to achieve product list with rest api (GET V1/products) or we should create own api call?

Where I can find all available params for searchCriteria for call

V1/products?

Where is documented that I can use

searchCriteria[filter_groups][0][filters][0][field] = category_id for
V1/products?

Thanks

Best Answer

There are default REST APIs in Magento2.

  1. website ID (or store ID) we have multisite : To filter according to the store or website there is no any REST APIs. To get list of product according to store or website reuired "REST Schema Endpoint Format". For example to get list of product for a single store we use the following call

    http://{baseurl}/rest/V1/products?searchCriteria[pageSize]=10
    

    suppose you have another store with store code "store2". then we use following url

    http://{baseurl}/rest/store2/V1/products?searchCriteria[pageSize]=10
    

    For more detail REST Schema end point

List of avail APIs Megento2 Rest Apis

For According to category use following url http://myfashionstore.com/rest/store2/V1/products?searchCriteria[pageSize]=10&searchCriteria[filterGroups][0][filters][0][field]=category_id&searchCriteria[filterGroups][0][filters][0][value]=6 enter image description here