Search REST API: How to Find Product in Magento 2 Using REST API

If you also want to provide a product search facility to your customer for your mobile application, then for this the Magento Rest API is being explained in detail below.

I hope this post will be helpful in making the search facility better and more relevant while connecting your Magento store to the mobile application.

How to search products details and their other information with image details are given with the search endpoint.

There is two default endpoint for searching products in Magento 2 store:

  • GET V1/search
  • GET V1/products

Through GET V1/search endpoint, both the registered customers and guest customers can search the product on Magento's store, for that they do not need any admin authentication.

Through the GET V1/products endpoint, we can search the whole store but we need an authentication token to verify the request.

This endpoint has direct access to product data.

 

Read more: List of all Search REST API

 

Search By Name From a Category Magento 2 REST API

As you can see in the below image below that we have searched the product from one category on the basis of name and the detail found is only data from one category.

Method: GET

Endpoint: 

http://wishusucess.com/rest/all/V1/products?searchCriteria[filter_groups][0][filters][0][field]=name&searchCriteria[filter_groups][0][filters][0][value]=%NEMATOFREE%25&searchCriteria[filter_groups][0][filters][0][condition_type]=like&searchCriteria[filter_groups][0][filters][1][field]=name&searchCriteria[filter_groups][0][filters][1][value]=%25Parachute%25&searchCriteria[filter_groups][0][filters][1][condition_type]=like

Payload: Not required

Search REST API Magento 2

 

Search Product By SKU Using REST API

We can also search the store's data on the basis of SKU, for that you can use the below-given method along with payload and endpoint, you will get the product on the basis of SKU search.

Method: GET

Endpoint:

https://wishusucess.com/rest/all/V1/products?searchCriteria[filter_groups][0][filters][0][field]=sku&searchCriteria[filter_groups][0][filters][0][value]=test-product-4&searchCriteria[filter_groups][0][filters][1][field]=sku&searchCriteria[filter_groups][0][filters][1][value]=test-product-3&searchCriteria[filter_groups][0][filters][2][field]=sku&searchCriteria[filter_groups][0][filters][2][value]=test-product-1

Payload: Not required

search product by sku REST API

 

In the above image, you can see the params details, I have given the sku "test-product-1" and we have received all data that belong to the similar sku.

 

Read more:

Payment Method: How to Configure Payment Methods in Magento 2

 

Get Product By Price API Endpoint

Method: GET

Endpoint:

https://wishusucess.com/rest/all/V1/products?searchCriteria[filter_groups][1][filters][0][field]=price&searchCriteria[filter_groups][1][filters][0][value]=10&searchCriteria[filter_groups][1][filters][0][condition_type]=from&searchCriteria[filter_groups][2][filters][0][field]=price&searchCriteria[filter_groups][2][filters][0][value]=100&searchCriteria[filter_groups][2][filters][0][condition_type]=to

Payload: Not required

search by price rest api Magento 2

Here, If you want to search products on the basis of price, then we have to give the price range, the range we can decide from x to y.

 

Similar Post:

Payment Gateways: List of Best Online Payment Method Option in 2022

Payment API: How to Make Payment Through REST API in Magento 2

Leave a Reply