I need to elaborate de URL that will bring all products with certain attribute_set_id through Magento 2 Rest api, and then change though the api the attribute_set_id of all those items. My problem comes on getting the URL to work to get the list of products. I get an empty array from the following code (and for sure attribute_set_id 14 exists and I have products with that attribute_set_id in my catalog).

$ch = curl_init($url."products?searchCriteria[page_size]=&
searchCriteria[filter_groups][0][filters][0][field]=attribute_set_id&
searchCriteria[filter_groups][0][filters][0][value]=14&
searchCriteria[filter_groups][0][filters][0][condition_type]=eq");

Any clue? Thanks


SOLVED:

There where many errors in the initial post. Here is my solution.

$ch = curl_init($url."products?searchCriteria[filter_groups][0][filters][0][field]=attribute_set_id&
searchCriteria[filter_groups][0][filters][0][value]=14&searchCriteria[filter_groups][0][filters][0][condition_type]=eq");

It has some syntax corrections and did it ALL IN ONE LINE.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.