Domanda

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!

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top