5

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?

2
  • Did you get any solutions ? Commented Nov 29, 2019 at 7:51
  • Magento 2.3 has GraphQL support. I haven't tried it but that might be an option.
    – robjingram
    Commented Dec 15, 2019 at 21:13

1 Answer 1

1

You can get labels to id mapping from OptionManagement service

2
  • 3
    Link does not open exact service in docs, please provide REST service URL here. GET /V1/products/attributes/{attributeCode}/options I suppose Commented Dec 16, 2015 at 17:34
  • I feared that might be the case :)
    – robjingram
    Commented Dec 16, 2015 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.