How to use V1/search to get the names and SKU's of the magento products
-
20-10-2020 - |
Question
How to use V1/search to get the names and SKU's of the magento products?
I need a text based search to get the names and SKU's of the magento products. While using V1/products API, the response is too much. I just need the name and the SKU, just like google suggestions come up when you type something.
I tried wit the V1/search api but no luck:http://192.168.1.180/magento/index.php/rest/V1/search?searchCriteria[filter_groups][0][filters][0][field]=name&searchCriteria[filter_groups][0][filters][0][value]=%nike%&searchCriteria[filter_groups][0][filters][0][condition_type]=like
Solution
Use V1/products
instead of V1/search
and add fields=items[sku],items[name]
GET parameter to the request URL. This allows to get only requested fields in the response.