Get orders from Magento Soap API
In this tutorial I show you how to get orders from Magento Soap API. In my last SOAP tutorial I showd how to set up SOAP with SOAPUI and get a valid session id. With this you can get all possible information from that interface. In this basic todo we look on order data and order detail informations.
Get orders from Magento Soap API
The featured image shows an example request to get all orders from your store. As you may see, there are no filters set, so you get all stored orders with salesOrderList. This may be a very long response, a good running shop may have thousands of orders. The only thing to set is the previous requested session id.
SalesOrderList allows you to set filter:
1 2 3 4 5 6 7 | <filters xsi:type="urn:filters"> <!--You may enter the following 2 items in any order--> <!--Optional:--> <filter xsi:type="urn:associativeArray" soapenc:arrayType="urn:associativeEntity[]"/> <!--Optional:--> <complex_filter xsi:type="urn:complexFilterArray" soapenc:arrayType="urn:complexFilter[]"/> </filters> |
There are two optional settings to filter order response. It is hard to find information on how to use filter and complex filter. A simple example for a filter to get only orders with status processing looks as follows:
1 2 3 4 5 6 | <filter xsi:type="urn:associativeArray" soapenc:arrayType="urn:associativeEntity[]"> <associativeEntity> <key>status</key> <value>processing</value> </associativeEntity> </filter> |
salesOrderInfo
If you need detailed information on orders, you can user salesOrderInfo to get it. For this request you need a valid session id and an increment id from this order. So if you are working on an interface to get magento order information, you have always to do two requests:
- salesOrderList
to get a filtered or non filtered list of all basic information for all orders in Magento - salesOrderInfo
with a valid increment id from an order you can get detailed information like shipping and billing addresses, or item data from that order
Note that this is also true all other Magento information like catalogProductList / catalogProductInfo or customerAddressInfo / customerAddressList for example. My last article showed you how to get a full list of possible requests.
Conclusion
With Magento SOAP API it is really simple to get shop information. You may use this interface to sync Magento with your ERP system. Magento SOAP API is a simple, fast and standardized interface to get information from a Magento store.
Hi, Tks for post.
Can I use filters with OR? Example: (state eq new) OR (state eq processing and incriment_id gt 1000)
So disappointed! For God’s sake add somewhere in title or body that this is a post for MAGENTO 1.
You created a Magento 2 blog and write articles for magento 1 without even adding a note