Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Export Orders API
 
zep007
Sr. Member
 
Avatar
Total Posts:  131
Joined:  2008-05-15
Connecticut
 

I have been integrating the Magento API with our internal system (filemaker) API lately, and cant find much (next to none) information on Magento’s order export API.

I need to export orders via a cron.  I would like to pull down just the orders marked processing, that have not been pulled down yet.

The Documentation order APi is not the best (altho better then nothing) I would love to see an example of the order list by filter call.  I assume that there is no ‘orders.new’ type call where Magento would remember which orders I already had pulled from the system. Or is there?

So currently, my plan is to run a script every hour and dynamically changing the time filter (order filter) depending on the server’s time minus 1 hour.

1. Make a call to the API and get the list of orders filtered by time created (within the hour) and the status of processing. 

2. Move through the list calling order.info for each record gathered.

3. Take that info and map/manipulate it into the local API.

4. Sendmail if completed successfully or with errors

I want to do this the best way, and the more I can get the built in Magento code to work for me the better.

Please let me know if there is a better/quicker way. 

Any advice would be very much appreciated!

Thanks

Zep

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben James
Jr. Member
 
Total Posts:  14
Joined:  2008-10-01
 

I’ve spent the last hour trying to do something similar, and have finally got it working. I’m using perl with Frontier::RPC, but you should be able to translate it across into whatever you’re using:

my $server Frontier::Client->newurl => "http://magentourl/api/xmlrpc/"debug => );

my $sessionID $server->call("login", ("username""apikey"));

my $result $server->call("call", ($sessionID"sales_order.list"[
    {
        updated_at 
=> {
            from 
=> "2008-10-05 12:49:51"
        
}
    }
]
));

I’m using the last update time, but you should be able to use created_at to to the same thing.

The ‘from’ parameter will only work with datetime datatypes (along with the ‘to’ parameter), but here are the rest of the types you can pass in (I had to dig into the Varien DB library to find them):

eq, neq, like, nlike, in, nin, is, null, notnull, moreq, gt, lt, gteq, lteq, finset

Hope that helps somebody who was looking for the same things as myself.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zep007
Sr. Member
 
Avatar
Total Posts:  131
Joined:  2008-05-15
Connecticut
 

your the man!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
8181
Jr. Member
 
Total Posts:  25
Joined:  2008-10-26
 

Anybody know how to get the right user permissions? I tried this, I set up a webservices role with access to all, but I still get permission denied. When I try to set individual permission instead of the blanket “all” I dont see anything about orders. Anyone know how to get the right permission?

Here is the error

Fault returned from XML RPC Server, fault code 623: Calling parameters do not match signature

 
Magento Community Magento Community
Magento Community
Magento Community
 
DDMAN
Sr. Member
 
Total Posts:  179
Joined:  2008-01-08
 

@ zep007

Did you get the order export to only pull orders in a status of processing rather then using a date time stamp?

I would like to every time I run a script pull the orders in processing.

Please advise

 
Magento Community Magento Community
Magento Community
Magento Community
 
Icecaster
Jr. Member
 
Total Posts:  4
Joined:  2008-11-11
 

you probably want to filter by status ‘pending’

 
Magento Community Magento Community
Magento Community
Magento Community
 
gelura
Jr. Member
 
Total Posts:  2
Joined:  2010-04-01
 

You could use sales_order.list from API’s documented in

http://www.magentocommerce.com/wiki/doc/webservices-api/api/sales_order#sales_order.info

There is a working example in that page like:

$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
    
$sessionId $proxy->login('apiUser''apiKey');
     
    
// Getting list of orders created by John Doe
    
var_dump($proxy->call($sessionId'sales_order.list', array(array('customer_firstname'=>array('eq'=>'John'), 'customer_lastname'=>array('eq'=>'Doe')))));
     
     
    
// Get order info 100000003
    
var_dump($proxy->call($sessionId'sales_order.info''100000003'));

Use your credentials for API created as indicated in

http://www.magentocommerce.com/boards/viewthread/23208/

Using API’s, even though it might be slower, it’s a huge help for developers.

Montreal Web Design

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top