Reputation: 722
I am working on a native application and need to get the list of product based on category.
Like when user clicks on a category I have to show list of products inside that category.
I tried a service but its only giving three field in return
http://www.dexample.com/index.php/rest/V1/categories/1680/products
response
{
"sku": "FB-Bridgewater",
"position": 1,
"category_id": "1680"
}
I need more information like name, image, price and more.
Upvotes: 2
Views: 2325
Reputation: 387
You can use the search API to fetch the more information of the Product.
This API will get you the products with details:
http://www.dexample.com/index.php/rest/V1/products?
searchCriteria[filter_groups][0][filters][0][field]=category_id&
searchCriteria[filter_groups][0][filters][0][value]=1680&
searchCriteria[filter_groups][0][filters][0][condition_type]=eq
The Generic Search API of Magento2 is
searchCriteria[filter_groups][<index>][filters][<index>][field]=<field_name>
searchCriteria[filter_groups][<index>][filters][<index>][value]=<search_value>
searchCriteria[filter_groups][<index>][filters][<index>][condition_type]=<operator>
where:
field
is an attribute name.
value
specifies the value to search for.
condition_type
specifies condition[ex: eq , finset, like, from, to]
Upvotes: 2