I'm new to Magento (Version 2) and am a bit confused by the variables for the calls in the API-Documentation (https://magento.redoc.ly/). As you might know there's not much explanation about what they stand for or possible values besides the datatype. Until now I could construct most calls with the help of this and other forums, but am now stuck on the call to get orders based on certain criteria, e.g. "new" orders, orders from the last n days (What does searchCriteria[filterGroups][0][filters][0][field] mean? What could be possible values???). Since this probably won't be the last call causing me such headaches I was wondering if there might be a document I didn't find yet, where there are further explanations.
Thank you very much for your help!
1 Answer 1
I think this article will help you a lot as it contains both the theory and the relevant examples (includin some on orders): https://devdocs.magento.com/guides/v2.4/rest/performing-searches.html
By checking this article, you will understand why searching for new orders can be a simple request as this one:
GET <host>/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=status&&searchCriteria[filter_groups][0][filters][0][value]=pending&&searchCriteria[filter_groups][0][filters][0][condition_type]=eq
Note - in my example, 'pending' is the status of the new orders, feel free to change it according to your needs.
-
1Hi Diana, thanks for your quick answer. This looks promising and actually fun to work with, haha. I guess I'll add asking questions here to my strategy of problem solving.Bardia Hahn– Bardia Hahn2021年04月20日 14:35:11 +00:00Commented Apr 20, 2021 at 14:35
-
no problem, you are most welcome! if you need more help please open new questions and i am sure we will gladly help :) cheers!Diana– Diana2021年04月20日 15:52:51 +00:00Commented Apr 20, 2021 at 15:52