8

Magento 2.3 Search Criteria with REST API, SortOrders not working in V1/Search API.

I am trying to fetch Category products using Magento REST API by below request URL.

http://127.0.0.1/magento230ee/rest/V1/search?searchCriteria[requestName]=quick_search_container&searchCriteria[filterGroups][0][filters][0][field]=category_ids&searchCriteria[filterGroups][0][filters][0][value]=4&searchCriteria[sortOrders][0][field]=name&searchCriteria[sortOrders][0][direction]=ASC

Using Above query I have to get the same result whether a name field is ASC or DESC Order in Query.

Only SortOrder is not working for the above query. How to apply sortOrders filter in product collection using the above query.

asked Feb 14, 2019 at 8:04
11
  • did you try asc and desc ? I mean in small caps instead of all caps Commented Feb 14, 2019 at 8:12
  • I have tried using ASC and DESC Commented Feb 14, 2019 at 8:13
  • that's weird, have you tried DESC or both not working? Commented Feb 14, 2019 at 8:42
  • None of working. Its not consideration for sortOrdres Commented Feb 14, 2019 at 8:47
  • 2
    I also faced this issue and found that magento sorts the result according to relevance value. At the end mobile team handled this at their end ; ) Commented Feb 14, 2019 at 9:07

1 Answer 1

0

Please try with below api, I hope its working for you.

http://127.0.0.1/magento230ee/rest/V1/search?searchCriteria[requestName]=quick_search_container&searchCriteria[filterGroups][0][filters][0][field]=search_term&searchCriteria[filterGroups][0][filters][0][value]=Test&searchCriteria[sortOrders][0][field]=created_at&searchCriteria[sortOrders][0][direction]=DESC&searchCriteria[pageSize]=10
answered Jul 5, 2019 at 9:28
1
  • I created custom API to update details but I want to update detail based on store code and store code is collected from payload any idea? Commented May 14, 2020 at 7:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.