Is it possible to send Magento Event Observer result to Custom API?
I wonder, is it possible to send Magento Event Observer result to custom API?
I'm trying t开发者_开发知识库o create an API to get new order via XML-RPC. Are there any examples around?
Thanks!
I haven't used any Magento Web Services, via XML-RPC. However, I have used normal SOAP Core API & SOAP V2 Web Services of Magento, and if you are using either of these two processes, then there is a solution for you.
For Magento Core API, the required method name is "sales_order.list
", and for the SOAP V2, the required method name is "salesOrderList
". The return type will be array of orders. The main useful thing in this Web Service method, is that there is an option to use filters. Now this filter will help you a lot in getting the new orders from a specified date & time, so you can pretty much use it to your own requirement.
For the V2 Web Services method "salesOrderList
", you can use the filter as:-
<salesOrderList>
<sessionId>51ba5b3ff707f874fd76369d65bb1b7f</sessionId>
<complex_filter>
<key>created_at</key>
<value>
<key>gt</key>
<value>2011-07-14 13:38:56</value>
</value>
</complex_filter>
</salesOrderList>
What the above sample code will do is that it will fetch / retrieve those orders in array format, which have been created after 01:38:56 PM of 14th July, 2011.
Hope it helps.
精彩评论