I have an integration that must get my products in stock via the Magento 2 API using SearchCriteria.
How could I filter it, since it's inside my
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
You can filter normally as any other attribute. Use this URL below to request, I'm using the rule "if it's greater than 0 than" to get products, and I put the limit of 50 products. The counting of total products is included during the return as you can see in the image.
https://www.mystore.com/ca_en/rest/all/V1/products? searchCriteria[filterGroups][filters][field]=is_in_stock& searchCriteria[filterGroups][filters][value]=0& searchCriteria[filterGroups][filters][conditionType]=gt& searchCriteria[pageSize]=50