Question

I'd like to be able to search products via the API but in my experiments so far I've found that if I am searching for a value of an option attribute (e.g. drop-down list) then I have to specify the ID of the option value. If I search by the text of the option then no records are returned. For example:

searchCriteria[filter_groups][0][filters][0][field]=size&
searchCriteria[filter_groups][0][filters][0][value]=S&
searchCriteria[filter_groups][0][filters][0][condition_type]=eq

Returns no results whereas:

searchCriteria[filter_groups][0][filters][0][field]=size&
searchCriteria[filter_groups][0][filters][0][value]=177&
searchCriteria[filter_groups][0][filters][0][condition_type]=eq

Does return results. Here 177 is the ID of the option value for size 'S' in the sample data set.

I'd rather that my API clients didn't have to know the IDs of option values in order to formulate queries so is there a way to search on the text of an option attribute?

Was it helpful?

Solution

You can get labels to id mapping from OptionManagement service

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top